mod_obj = ppms.get_target_module() def on_load(): if (ppms.uvar_get('@G119') == 'foo'): ppms.uvar_set('@G119', 'bar') ppms.ui_message_id('0000') def on_initial_focus(): mod_obj.menu(12) mod_obj.open_module('005544') def on_focus(): ppms.ui_message_box('focus message', 'Hello World') def on_reset(): mod_obj.menu(12)
Function | Execution time |
---|---|
Python code which is not encapsulated in a specific function will be called at module load (default behaviour) | |
on_load() | code in this function is executed also on module load |
on_initial_focus() | code in this function is executed when module is focused the first time |
on_focus() | code in this function will be called everytime a module is focused |
on_reset() | code in this function will be called everytime after a module was reset |
on_before_mv_switch(old_mv, new_mv) | code in this function will be called prior to application of a different MV / takes two arguments - ModuleVariant objects representing "old" and "new" MV |
on_after_mv_switch(old_mv, new_mv) | code in this function will be called after application of a different MV / takes two arguments - ModuleVariant objects representing "old" and "new" MV |
Method | Parameter | Return value | Comment |
---|---|---|---|
get_target_module() | returns a target module (the one which receives any module-related commands) of the running macro (returns a Module instance) | can't be used in value ranges; when a module is opened from the macro, the opened module will become the target module; when the target module is closed, it's invoker becomes target module. | |
get_macro_module() | returns the module the python macro is in, this can be the same as from macro_gettargetmod, but in case of pure macro modules, it will be different (returns an instance of Module class) | can't be used in value ranges | |
get_panels() | returns a Python list containing instances of class Panel of all currently opened panels | can't be used in value ranges | |
get_context_df() | returns the DataField instance from which the macro was called when accessible if no instance can be found, "None" object is returned |
can't be used in value ranges | |
client_exec(script) | script: string, when dealing with line breaks, the string must be encapsulated in """, e.g. """import os import sys""", othewise you get an error like "EOL while scanning single-quoted string" | ||
ge_set_auto_layout_gap(gapwidth: i2_t) | gapwidth: int | sets the value of the graphic-editor-setting auto-layout-gap to gapwidth and sends it to the client | |
echo_off() | switch to echo-off-mode (don't send updates, also enables message-off-mode) | ||
echo_on() | switch to echo-on-mode (send all updates immediatly) | ||
msg_off() | switch to message-off-mode (suppress user-queries). Messages that have no assumption set are confirmed with the default answer. | ||
msg_on() | switch to message-on-mode (do not suppress user-queries). Messages that have no assumption set are confirmed with the default answer. | ||
msg_pop() | returns MessageStackItem instance or none | get last MessageStackItem from message-stack | |
msg_set_assumption(message-id, reply) | message-id: String reply: int |
set assumption for message-id that should be used in message-off-mode. Stack is kept, as long as the macro runs | |
msg_get_assumption(String message-id) | message-id: String | get assumption for message-id | |
msg_delete_assumption(String message-id) | message-id: String | remove assumption for message-id | |
msg_clear_assumptions() | remove all assumptions | ||
changeset_number() | returns the changeset number of the server program | ||
reload_server() | advise the planta deamon to reload all preloaded server-instances to let data-dictionary-changes take effect | ||
change_password(username, password) | username: string, password: string | set password of the given user to the new one | |
distribute_effort_for_list(records) | records: list of MtsRecord | used internally by effort distribution functionality provided via Schedule Module subclass, not to be used directly | |
get_ppms_builtins() | dict | used to read and create the dictionary key "ppms" in the python builtins. Further keys should be added to a dictionary in the key "ppms". | |
get_query(id) | id: id of a record in DT342 | SQL or HQL query | used to read a query of table dt343. |
Method | Parameter | Return value | Comment |
---|---|---|---|
search_record(dt_num, key_list, di_list, dblookup) | dt_num: int for data table number key_list: list containing key values for the searched record (values in appropriate type of the key DIs: string for textual keys DIs, int for N2 or N4 key DIs) di_list: int list containing required DI numbers dblookup: boolean, telling whether DB-query may be send if requried DIs are missing |
returns a DtpRecord instance or None when no record was found or any of the required dis is missing | |
create_record(dt_num, di_dict) | dt_num: int for data table number di_dict: dictionary with elements in form [DI python name]:[value] |
DtpRecord instance on success, None on failure (e.g. no validation possible) | Dictionary must be populated with all primary key dis and their values except autoid dis. create_record() returns an existing record if there is one. Use the DtpRecord.state() method to check whether it is a duplicate |
Method | Parameter | Return value | Comment |
---|---|---|---|
ui_statusbar_set(text) | text: String | display a message in the main statusbar | |
ui_statusbar_clear() | clear main statusbar | ||
ui_message_box(caption, text, blocking = 1, ole_id = None, button_list = ['OK'], number_of_input_fields = 0) | caption: String text: String blocking: Boolean (stop processing macro until user-reply is available) ole_id: String (id of message icon) button_list: list of String (list of names of buttons of message) number_of_input_fields: Int (number of text fields of message) |
displays a global modal message box with with specified parameters. First 2 parameters are mandatory. See example below and MessageStackItem class description. | |
ui_message_id(id: string) | id: String | displays a message for the given PPMS id | |
ui_set_system_title(title: string) | title: String | sets the system title. Empty string sets back to default system title |
buttons = ['OK','Cancel'] ppms.ui_message_box('Test','Extended message box.', 1, '000207', buttons, 3) msg = ppms.msg_pop() ppms.ui_message_box('Replied', buttons[msg.get_reply()-1]) ppms.ui_message_box('Input', msg.get_input())
Method | Parameter | Return value | Comment |
---|---|---|---|
session_export_start(filename) | filename: String | function returns boolean: True if starting session export succeeded, False otherwise | may not succeed when another session export is started or file could not be opened |
session_export_stop() | returns the filename as string if export succeeded, None otherwise | no success may indicate that no session was started or e.g. disk full | |
session_export_is_enabled() | return boolean | True if enabled, False otherwise |
with open(filename, encoding='utf-8') as log: log_txt = log.read()
Method | Parameter | Return value | Comment |
---|---|---|---|
get_current_server_script() | returns the last executed server script (in string format) or None | is used in source provider for debugger only |
Method | Parameter | Return value | Comment |
---|---|---|---|
start_service(function, timeinterval) | function: function timeinterval: Integer |
add a python function to the service function list. This function will be executed periodically on the server in the passed timeinterval (milliseconds) | |
get_services() | returns list of service functions running on the server | ||
stop_service(function) | function: function | removes a function from the service function list, so the server stops the periodic execution |
Method | Parameters | Return value | Comment |
---|---|---|---|
uvar_get(uvar_id: string) | uvar_id: String | returns a value of the given variable. Note: When there's more than one value, these values are unsorted. |
uvar_id is a variable name (e.g. "@15", "@G191", "@M4") |
uvar_set(uvar_id: string, value: respective data type) | uvar_id: String value: respective data type |
boolean: true when setting the variable successfully, false otherwise | sets value of the given variable (@D, @G or @M ) |
Method | Parameters | Return value | Comment |
---|---|---|---|
start_timer(timer_name: string) | timer_name: String, name of timer under which the statistics are saved | It starts to measure statistics about execution of code after calling this function. | |
stop_timer() |
|
It ends up the measuring of the statistics and insert the new record into DT324 with collected information. |
Method | Parameter | Return value | Comment |
---|---|---|---|
db_get_auto_commit() | returns True if the auto commit is on, False otherwise | ||
db_set_auto_commit(state) | state: Boolean | takes boolean argument, enables or disables auto commit | |
db_commit() | commits the pending DB operations | ||
db_rollback() | rolls back any pending operations | ||
db_get_dbms_name() | Number indicating the database type | This corresponds to the config parameter Q1TYPE in ppms.conf (e.g. return value "000002" = Oracle database; return value "000004" = MSSQL database) | |
db_modify(query) | query: String, takes SQL query string (without a trailing semicolon) as the only argument. | returns a number of affected records can raise DatabaseError exception |
intended for INSERT/UPDATE/DELETE statements or other "non-selects" like ALTER SESSION |
db_select(query) | query: String, takes SQL query string (without a trailing semicolon) as the only argument. | returns the result of the query in the form of a list of sublists (each sublist will contain a list of column values for the specific DB record) can raise DatabaseError exception |
intended for SELECT statements conversion of numeric data (column) types from Oracle to PPMS (C) NUMBER (any configuration thereof) will always be represented as double (r8_t) in PPMS, and as float in Python (due to the current PPMS DB interface implementation) |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_active_module() | returns a module (Module instance) that was a target of the currently processed event | e.g. during processing of "modify DF value" or "activate DF" event, this will be the module that contains the modified DF. If the event targets a listbox module, the module that contains the listbox is returned instead. | |
get_focused_module() | returns latest client side-focused module (Module instance) | None might be returned e.g. when the currently focused module is closed (as no new focus events are processed during event processing) |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_main_module() | Module instance: the main module in panel | ||
get_modules() | Python list of modules in Panel | includes main module | |
set_title_suffix(suffix:string) | suffix: string (a string to be appended to the panel's title) | None | Set suffix to panel title |
Method | Parameters | Return Value | Comment | |
---|---|---|---|---|
get_uid() | int: Internal UID of the module | |||
get_id() | string: customizing ID of the module (e.g. 009845) | |||
get_root(position) | position: int (root position, 0..4) | Root instance: root at the given position | ||
get_das() | list: of all data areas in the module (MtsDataArea instances) | |||
get_da (name) | name: string (customizing-name) | DataArea instance: DataArea with specified customizing-name from dg410 | ||
get_customizing() | ModuleCustomizing instance: customizing for this module instance | |||
set_statusbar(text) | text: string (text to be displayed) | int: 0 for failure, anything else for success | ||
clear_statusbar() | int: | |||
message_box(caption, text) | caption: string text: string |
displays a module-specific modal message box with OK button, specified caption and text message | ||
get_roots() | list: of Root instances from the given module | |||
menu(id) | id: ID of the menu item (command) to activate. See Menüpunkte for a list of possible IDs | int: 0 on failure, non-zero on success | ||
set_title_suffix(suffix) | suffix: string (a string to be appended to the module's title) | None: | ||
open_module(id, skip_macro=False, forced_status = 0, dock_to_module = -1, dock_style = -1, dock_proportion = -1.0, foreground = -1, auto_hide = -1, focus = 1) | id: string (ID of the module to be opened) skip_macro: int/bool (optional argument, the default value is False; when True, modules macro will not be executed) forced_status: int [0,1,2] defines wether
dock_to_module: int (uid of module to be attached to, -1 dock to panel) dock_style: int (0..4),
dock_proportion: double (0..1) foreground: -1 is default, in which case client uses its default value; 0 (or False) and 1 (or True) are also possible auto_hide: -1 is default, in which case client uses its default value; 0 (or False) and 1 (or True) are also possible focus: 1 to focus the module after opening, 0 for otherwise |
Module instance or None if an error occurred during opening of the module | Opens a new module in the context of this module. If a module macro is running, the newly opened module will become a current target module of the macro. |
|
is_stub() | bool: True if the module is a stub module (= it was only loaded as a framework for performance reasons), False if module was loaded completely | |||
get_invoker_module() | Module instance or None if no invoker module is linked | |||
get_panel() | Panel instance: of Module | |||
get_invoker_rec() | MtsRecord instance: returns the record from which module was invoked | |||
get_new_L_var() | dict:: key is variable number, value is list of strings | returns the modules @L Structure that is used for passing it to an invoked module | ||
get_current_L_var() | dict: key is variable number, value is list of strings | returns the modules @L Structure that was given by the invoking module | ||
set_new_L_var(var_no, values) | var_no: number of @L variable values: a list of values |
bool: | Sets the @L variables of the next module that will be called from the current one | |
set_current_L_var(var_no, values) | var_no: number of @L variable values: a list of values |
bool: | Sets the @L variables of the current module | |
create_mv(title) | title: string | string: id of the newly created MV | creates new MV with give title using current module CU settings | |
delete_mv_by_id(id) | id: string | bool: succes/failure indication | deletes MV of given name from DB, updates all affected MV comboboxes and resets to base CU those modules that had the MV applied at the time of its deletion | |
save_mv_by_id(id = None) | id: string, optional | bool: success/failure indicator | stores current CU changes into MV of given id; the MV must already exist; if id is not specified (is None), currently applied MV's id will be used | |
apply_mv_by_id(id) | id: string | bool: success/failure indicator | applies MV of given ID to module's CU | |
apply_mv_by_title(title) | title: string | bool: success/failure indicator | applies MV of given title to module's CU (assumes the title is unique across the entire list of module's MVs) | |
get_applied_mv_id() | string: id of currently applied MV | |||
focus() | Gives the module an input focus on client- as well as on server side. Same effect as if user clicked inside the module to give it a focus. | |||
reset_cu() | Sets the module variants back to base setting | |||
refresh_dts(dt_numbers) | dt_numbers: a tuple containing numbers of affected DTs | reselects records for all DAs in the module that use one of the given DTs as their determining DT; intended to be used after TCalc to refresh contents of those DTs that can get new records during the TCalc process; example use: mod.refresh_dts((472, 888)) | ||
has_unsaved_changes() | Returns TRUE if the module was changed and it wasn't saved. | |||
enableChangesIndicator() | This method will enable the "asterix"-mechanism of the current module. An asterix is shown in the title of the module on further changes. The current state of the asterix is not changed (If it is allready not shown it will still be not shown). | |||
disableChangesIndicator() | This method will disable the "asterix"-mechanism of the current module. An asterix is no longer shown in the title of the module on further changes. The current state of the asterix is not changed (If it is allready shown it will still be shown). | |||
getChangesIndicator() | bool: True if the module's title would include an asterisk * if it had unsaved changes, False otherwise. |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_uid() | int: Internal UID of the root | ||
get_das() | list: of all top-level DataAreas in the root | ||
get_da_by_id(cust_id) | cust_id: string (customizing ID of the DA) | DataArea instance | |
get_da(cust_name) | cust_name: string (customizing-name of the DA) | DataArea instance | |
count_records_by_dac_id(dac_id) | dac_id: string (customizing ID of the DA to count records in) | int: Number of records in the Root from the given DA | |
count_records(dac_name) | dac_name: string (customizing-name of the DA to count records in) | int: Number of records in the Root from the given DA | |
get_record_by_dac_id(dac_id, position) | dac_id: string (customizing ID of the DA) position: position of the record in the DA |
MtsRecord instance | Gets top-level record from the given DA at the given position |
get_record(dac_name, position) | dac_name: string (customizing-name of the DA) position: position of the record in the DA |
MtsRecord instance | Gets top-level record from the given DA at the given position |
get_records_by_dac_id(dac_id) | dac_id: string (customizing ID of the DA) | list: of records from the given DA that lie directly in the root. | |
get_records(dac_name) | dac_name: string (customizing-name of the DA) | list: of records from the given DA that lie directly in the root. | |
get_customizing() | RootCustomizing instance: for this Root | ||
insert_record_into_da(dac_name) | dac_name: string (customizing-name of the DA) | MtsRecord instance : of the inserted record, None on failure | inserts a record into the specified top-level-da |
insert_record_into_da_by_id(dac_uid) | dac_uid: string (customizing-uid of the da) | MtsRecord instance of the inserted record, None on failure | inserts a record into the specified top-level-da |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_uid() | int: Internal UID of the DA | ||
get_id() | string: customizing ID of the DA | ||
get_customizing() | DataAreaCustomizing instance: for this DA | ||
count_records() | int: Number of records in the entire DA | ||
get_marked_records() | list: unsorted list of all marked records in the data area (list of MtsRecord instances) | ||
get_records() | list: unsorted list of all MtsRecord instances in DA | ||
get_attribute(customizing_name) | customizing_name: customizing name of the attribute from DT410 you want to access | The value of the passed attribute |
Method | Parameters | Return value | Comment | |
---|---|---|---|---|
get_uid() | int: Internal UID of the record | |||
count_dfs() | int: number of DFs in the record | |||
get_df_by_id(cust_id) | cust_id: string (customizing ID of the DF to get) | DataField instance: for the given DF customizing ID | ||
get_df_by_position(position) | position: int (position of the DF in the DA, starting with 0) | DataField instance | ||
get_df (cust_name) | cust_name: string (defined in dt412 or alternatively in dg411) | DataField instance | ||
get_dtp_record() | DtpRecord: for this MtsRecord | |||
count_dfs_in_window(window) | window: int (the number of the window in question) | int: number of DFs in the given window | ||
get_df_in_window_by_position(window, position) | window: int (window number) position: position of the DF in the given window) |
DataField instance: for the DF at the given position in the given window | ||
mark() | bool: | Also marks on the client side. | ||
unmark() | bool: | Also unmarks on the client side. | ||
scroll_to() | bool: | Advice Client to scroll to this display_record | ||
is_marked() | bool: True if the record is marked, False otherwise | |||
count_children_by_dac_id(child_dac_id) | child_dac_id: string (customizing ID of the child DA in which we are counting the child records) | int: Number of child records from given DA. | ||
count_children(child_dac_name) | child_dac_name: string (customizing-name of the child DA in which we are counting the child records) | int: Number of child records from given DA or from all child DAs. | if argument is left blank or NULL the total number of child records from all child DAs is returned | |
get_children_by_dac_id(child_dac_id) | child_dac_id: string (customizing ID of the child DA to get the records from) | list: of child records from the given DA | ||
get_children(child_dac_name) | child_dac_name: string (customizing-name of the child DA to get the records from) | list: of child records from the given DA | ||
get_da() | DataArea instance: for DA this record belongs to | |||
insert_child_by_dac_id(child_dac_id) | child_dac_id: string (customizing ID of the child DA in which we want to insert) | MtsRecord instance of the record we inserted, None if insertion failed | Inserts a new child record below the given parent record to the given child DA. The child DA must exist for the given parent record. If DA that is to be inserted to is identical with parent record's DA, the new record will be inserted next to the parent record (after it). | |
insert_child (name) | name: string (customizing-name of the child DA in which we want to insert) | MtsRecord instance of the record we inserted, None if insertion failed | Inserts a new child record below the given parent record to the given child DA. The child DA must exist for the given parent record. If DA that is to be inserted to is identical with parent record's DA, the new record will be inserted next to the parent record (after it). | |
insert_recursive_child() |
MtsRecord instance of the record we inserted, None if insertion failed | Inserts a new inner recursive child into given record | ||
insert_before() | MtsRecord instance of the record we inserted, None if insertion failed | Inserts a new sibling record before given record | ||
insert_after() | MtsRecord instance of the record we inserted, None if insertion failed | Inserts a new sibling record after given record | ||
get_parent() | MtsRecord instance of parent, None if no parent exists | |||
get_module() | Module instance: in which Record is |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_raw_value() | various data types: the value of the DI which is associated with the DF, data type differs based on the DIs DB type | ||
get_text_value() | The value of the DF as it is displayed in the client | ||
set_raw_value(value) | value: data type must match the one that is used by the DF's underlying DI | bool: | |
set_text_value(value) | value: string representation of the value, is treated the same way as the text value filled in by the user | bool: | |
focus() | bool: | Sets input focus to this DataField | |
scroll_to() | bool: | Advice Client to scroll to this display-df | |
get_id() | int: customizing ID of this DF | ||
get_di() | DataItem instance: underlying DI | ||
is_input() | bool: True or False | Checks if the DF is an input field | |
make_output() | bool: | Overrides DF's customizing, making it behave as an output field | |
make_input() | bool: | Overrides DF's customizing, making it behave as an input field | |
get_record() | MtsRecord instance: in which Datafield is | ||
get_customizing_name() | string, None if no customizing id found | customizing name from DF customizing with fallback to DI customizing name | |
get_df_config() | string: | Created by python wrapper. Returns value of DI040968 | |
get_customizing() | DataFieldCustomizing | ||
set_df_symbol(symbol_id) | symbol_id: id of symbol of DF to be set | bool: true if the symbol was successfully set | |
get_attribute(customizing_name) | customizing_name: customizing name of the attribute from DT411 you want to access | The value of the passed attribute |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_id() | String: returns message-id | ||
get_text() | String: returns message-text | ||
get_reply() | Int: returns button-id | 0 = ERROR, 1 = OK, YES / 2 = NO / 3 = CANCEL OR order (1...number_of_buttons) of pushed button when you are using ui_message_box method | |
get_input() | PyTuple: returns tuple of strings | for msg boxes created by using ppms.ui_message_box constructor: returns tuple of values from input boxes or None if there are no input boxes |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_dac_by_id(cust_id) | cust_id: string (customizing ID of the DA) | DataAreaCustomizing instance: customizing for the DA with given ID | |
get_dac (name) | name: string (customizing-name of da) | DataAreaCustomizing instance: customizing for the DA with given cust-name of da |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_dacs() | list: of DataAreaCustomizing instances: (the top-level DAs from the given root) |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_id() | string: customizing id of the DA | ||
get_name() | string: customizing name of the da | ||
get_children() | list: of child DataAreaCustomizing instances of this DAC | ||
count_dfcs() | int: number of DFs in this DA | ||
get_dfc_by_id(dfc_id) | dfc_id: int (ID of the DF, same ID as the one returned by get_id() method of DataFieldCustomizing) | DataFieldCustomizing instance: customizing of the DF with given ID | |
get_dfc_by_position(position) | DataFieldCustomizing instance customizing of the DF that is currently sitting at the given position in the DA | ||
get_dfc (name) | name: string (cust-name of dfc defined in dg411 or dg412) | DataFieldCustomizing instance: customizing of the DF with given cust-name | DI041036 DI-Python-ID |
set_sym_area_sep_w1(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Datensatztrenn. F1 |
get_sym_area_sep_w1() | string: ID of the symbol | Symb. Datensatztrenn. F1 | |
set_sym_area_sep_w2(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Datensatztrenn. F2 |
get_sym_area_sep_w2() | string: ID of the symbol | Symb. Datensatztrenn. F2 | |
set_sym_area_sep_w3(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Datensatztrenn. F3 |
get_sym_area_sep_w3() | string: ID of the symbol | Symb. Datensatztrenn. F3 | |
set_sym_frame_w1(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Rahmen F1 |
get_sym_frame_w1() | string: ID of the symbol | Symb. Rahmen F1 | |
set_sym_frame_w2(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Rahmen F2 |
get_sym_frame_w2() | string: ID of the symbol | Symb. Rahmen F2 | |
set_sym_frame_w3(symbol_id) | symbol_id: string (ID of the symbol) | None: | Symb. Rahmen F3 |
get_sym_frame_w3() | string: ID of the symbol | Symb. Rahmen F3 | |
disable_satisfaction() | None | None | Erfüllung |
enable_satisfaction() | None | None | Erfüllung only works when satisfaction-rule is not empty |
has_satisfaction() | None | satisfaction enabled ? true : false | Erfüllung |
get_satisfaction() | None | string: satisfaction rule | Erf.-Regel |
set_satisfaction(rule) | satisfaction-rule: string | None | Erf.-Regel |
set_to_output() | None | None | Ausgabe |
set_to_input() | None | None | Ausgabe |
is_readonly() | None | is output ? true : false | Ausgabe |
set_never_display() | None | None | Nie anzg. |
unset_never_display() | None | None | Nie anzg. |
is_never_display() | None | is never display ? true : false | Nie anzg. |
set_display_behavior(d-behavior) | d.-behavior in [0..3] | None | Anzeige |
get_display_behavior() | None | display-behavior in {0, 1, 2, 3} | Anzeige |
set_permission_create() | None | None | Anlegen |
unset_permission_create() | None | None | Anlegen |
has_permission_create() | None | has permission create ? true : false | Anlegen |
set_permission_insert() | None | None | Einfugen |
unset_permission_insert() | None | None | Einfugen |
has_permission_insert() | None | has permission insert ? true : false | Einfugen |
set_permission_move() | None | None | Verschieben |
unset_permission_move() | None | None | Verschieben |
has_permission_move() | None | has permission move ? true : false | Verschieben |
set_permission_delete() | None | None | Löschen |
unset_permission_delete() | None | None | Löschen |
has_permission_delete() | None | has permission delete ? true : false | Löschen |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_id() | int: customizing id of the DF Feldnummer | ||
get_window() | int: Number of the window this DF sits in | ||
set_window(window) | window: int (number of window where DF should be placed) | ||
get_position() | int: Current position of the DF in the DA | ||
get_heading() | string: Heading of the DF | ||
set_heading(heading) |
heading: string (heading of DF value to be set) | ||
get_default_value() | string: Default Value of DF | ||
set_default_value(dv) | dv: string (default value to be set) | ||
get_regex_criteria() | string: regex search criteria | ||
set_regex_criteria(criteria) | criteria: string (regex search criteria to set) | None: | |
get_search_criteria() | tuple: of two string values (from and to) | ||
set_search_criteria(sc_from, sc_to) | from, to: string (values of from and to components) | None: | |
is_mandatory() | bool: True or False | ||
set_mandatory(mandatory) | mandatory: int/bool | None: | |
set_symbol(symbol_id) | symbol_id: string (ID of the symbol) | None: | |
get_symbol() | string: ID of the symbol | ||
set_heading_symbol(symbol_id) | symbol_id: string (ID of the symbol) | None: | |
get_heading_symbol() | string: ID of the symbol | ||
show(window) | window: int window where the field should show up | None: | Show this DF column |
hide() | None: | Hide this DF column |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_id() | string: customizing id of the MV | ||
get_title() | string: title of the MV | ||
get_description() | string: description of the MV | ||
get_type() | string: type of the MV | possible values:"base" (indicates base CU), "standard" (MV created by customizers, not by regular users),"user" (MV created by current user) | |
is_favorite() | boolean: True if the MV is current user's favorite, False otherwise |
Method | Parameters | Return value | Comment |
---|---|---|---|
DtpPool(number) | number : int (number of the DT) | Iterator for DataRecords within the DTP for the DT with the given number | example: "for record in DtpPool(461) ..." |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_di_by_id(number) | number : int (number of the DI) | DataItem instance from the DataRecord with the given number | |
get_di (name) | name: string (customizing-name) | DataItem instance from the DataRecord with the given cust-name from dt412 | |
get_children(dt) | dt: int (data table number) | returns list of direct children of current record which are from passed data table | |
save(dis) | dis: (optional) a tuple containing CU names of DIs that are to be saved (any modified DIs that are not mentioned in this list will not be saved); this list can be applied only to UPDATE operation, not to INSERT operation (new record stored into DB using save() method will store all DIs, regardless of the "dis" list (this is a limitation caused by current server-side implementation of storage of DTP records into DB) | bool: Operation success/failure indicator | stores (INSERT or UPDATE) all pending changes in the given DTP record into DB |
delete() | bool: Operation success/failure indicator | deletes a record and all children, failure when the deletion could not be done (e.g. when children can not be deleted) | |
state() | int: the state of a record | Meaning of the return value: 0 = DtpRecord.NONEXISTENT: the record does not exist on server (NULL) 1 = DtpRecord.INVALID: the primary key or relations are not valid 2 = DtpRecord.NEW: the record is valid, but not stored in database 3 = DtpRecord.STORED: the record is stored in database |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_value() | Value of the DI, data type differs based on the DIs DB type | ||
get_tech_value() | "Technical" value of the DI, data type differs based on the DIs DB type | Is different from the ordinary DI's value for I-TEXT type for instance, in which case the ID of an I-TEXT will be returned instead of the I-TEXT itself | |
get_dtp_record() | DtpRecord instance: for this DataItem | ||
get_dfs() | list: of DataField instances which contain DataItem | ||
set_value(value) | value: data type of the value must match that of the DI; supported Python data types and their respective PPMS data type counterparts: int (N2, N4, N8), float (N8), string (X) | Same as with set_string_value() | |
set_string_value(value) | value: string (ATTENTION: value will first be converted to actual data type using standard procedures, i.e. the same process as when user inserts a value into a DF for instance) | int: some Errorcode: 0: SUCCESS 1: General FAILURE 2: Wrong Format 3: Refused because DI is used in primary key |
Validation does not happen after filling some DI with values (happens on MTS level). So the method refuses to set a value on DI that is part of primary key |
get_id() | string | Customizing id of the DI (value of Planung 1: Anfang) | |
get_customizing_name() | string, None if no customizing id found | customizing name from DI | |
is_hyperlink() | bool: True if this Data Item connects to a hyperlink | ||
get_hyperlink_type() | enum: Identifies the type of Hyperlink this Data Item connects to. Possible values are UNSTRUCTURED: A primitive Hyperlink without structures CLIENT_BASED: A Client-based Hyperlink without a binary object SERVER_BASED: A Server-based Hyperlink with a binary object NO_HYPERLINK: This Data item is not a Hyperlink at all |
These values are stored in the Hyperlink class. So, to check if a DI is e.g. a server-based Hyperlink, you would use this call:if (di.get_hyperlink_type() == ppms.Hyperlink.SERVER_BASED) | |
get_hyperlink() | Hyperlink:The Hyperlink this data item connects to, or None if this di does not have a hyperlink. | If this Data Item connects to a Hyperlink, this Hyperlink object is returned. If this is not a hyperlink object, but it belongs to a Hyperlink's record in a schema's Hyperlink data table, the Hyperlink for this record is returned. Else, None is returned | |
insert_hyperlink() | Hyperlink:A new (empty) hyperlink object for this Data Item, or None if this di is not a hyperlink di. | If this di did not have a hyperlink before, a new record for this Hyperlink is now inserted. If it did already have a hyperlink object, this object is returned without any changes. Note that the hyperlink data structures are only created, they are not yet written into database. To do this, save this di's record (preferably after updating the Hyperlink object by using the Hyperlink's set_value-method) |
Method | Parameters | Return value | Comment |
---|---|---|---|
get_id() | int: The internal ID used to identify this hyperlink | Together with the schema, this identifies this hyperlink's record in its hyperlink table | |
get_schema() | string: A short string for the schema of this Hyperlink, e.g. "Q5B" | Together with the id, this identifies this hyperlink's record in its hyperlink table | |
get_initial_crc() | int: The crc of this Hyperlink's OLE object when it was requested the last time | ||
get_current_crc() | int: The crc of this Hyperlink's OLE object like it is now | May be different from initial_crc if another Client updated this object in your database | |
get_database_crc() | int: The crc field of this hyperlink in its hyperlink table | Should be identical to get_current_crc | |
get_title() | string: The title in the data item that connects to this hyperlink | ||
get_url() | string: The destination and name of this hyperlink's data file | ||
get_hyperlink_di() | DataItem The data item that links to this Hyperlink object | ||
get_record() | DtpRecord instance: The record that contains this hyperlink's attributes | Every db schema stores its hyperlinks in its own data table. Note that this record also contains the binary file of this hyperlink (as a blob), but you cannot directly access this Blob object with the usual dtp-record-methods. Use the Hyperlink's methods get_blob and set_value to do this. | |
get_blob() | ByteArray: The binary object of this hyperlink (Blob object in the database) | Note that BLob objects are read into Python as ByteArrays. This allows e.g. easy writing of Blob objects into data files with usual Python binary file methods | |
set_value(binary=None, url=None) | binary: ByteArray: The binary object that defines this hyperlink (if server-based) url String: The destination and name of this hyperlink's file. Important! Since this pathname contains backslashes \, you should use Python’s raw string notation, e.g. r"C:\docs\file.doc" not just "C:\docs\file.doc" |
bool: True if any values have been written into the Hyperlink object, False if not (e.g. because no parameters were given or because this Hyperlink's data item type does not support this parameter) | Updates the values of this hyperlink object. Note that the values are only updated, they are not yet written into the database. To do this, save this hyperlink's record. The displayed title of the hyperlink will be the filename of the url (= the part of the url after its last backslash \). Both parameters can be empty (None). If a parameter is empty, this attribute is left unchanged. The method only updates the Hyperlink object if at least one parameter is not empty. Note that an empty string "" is different than None. If this method is called with url = "", the current url will be overwritten by an empty string (= deleted). If this method is called without the parameter url, the url of this hyperlink will be left unchanged. Note that only server-based hyperlinks have their own blob-object. If this Hyperlink belongs to a di that is client-based, only the parameter filename is updated, the parameter binary will be ignored. |
delete_blob() | string: True if deleting was successful, False otherwise | Removes the binary object that defines this hyperlink. The hyperlink itself (= the structural representation including title and filename) remains unchanged. Note that the binary is not yet deleted in the database, but it will be once its hyperlink di (or the hyperlink record itself) is saved | |
delete() | string: True if deleting was successful, False otherwise | Deletes the complete Hyperlink object with all its data, as well as the record of this hyperlink, setting the internal value of the data Item that links to this hyperlink to 0 Attention: This means that the Hyperlink object can no longer be used after this method was called! |
Python module | Usage |
---|---|
ppms_cu.py | Provides further access to the PLANTA API |
from ppms import ppms_cu def on_load(): mod_id = ppms_cu.Helper.get_global_setting('startup_module_persons_users_roles').alpha120.get_value() ppms.get_macro_module().open_module(mod_id)