Python_ID_ProjectDataSheet
needs to be replaced by the value from the Python ID field of the newly created global setting of the project data sheet.
# The following is presumed in order to be able to read the module ID from the global settings #import of the ppms_cu Pyrthon module from ppms import ppms_cu # Definition of the module object mod_obj = ppms.get_target_module() # Definition of the module ID. By means of the self-defined Python ID # it is read from the global settings. target_mod_id=ppms_cu.Helper.get_global_setting("Python_ID_Projektdatenblatt").alpha120.get_value() #Read project ID of the record which is opened on the link. pr_id = ppms.get_context_df().get_record().get_df ("pr_id").get_raw_value() # Set variable _L30_ for the module which is opened mod_obj.set_new_L_var(30, [pr_id]) #Open the module mod_obj.open_module(target_mod_id)
pr_id = ppms.get_context_df().get_record().get_df ("pr_id").get_raw_value()
pr_id = ppms.get_context_df().get_record().pr_id.get_raw_value()
pr_id = ppms.get_context_df().get_raw_value()
from ppms import ppms_cu mod_obj = ppms.get_target_module() # Definition of the module dialog message ID target_mod_id=ppms_cu.Helper.get_global_setting("Python_ID_Projektdatenblatt").alpha120.get_value() dialog_id=ppms_cu.Helper.get_global_setting("Python_ID_Dialogmeldung").alpha120.get_value() pr_id = ppms.get_context_df().get_record().get_df ("pr_id").get_raw_value() mod_obj.set_new_L_var(30, [pr_id]) # Output of the dialog message ppms.ui_message_id(dialog_id) # If the user clicks on "Yes" ("if"), the module is opened, # otherwise ("else") the record is marked. if ppms.msg_pop().get_reply() == 1: mod_obj.open_module(target_mod_id) else: ppms.get_context_df().get_record().mark()
from ppms import ppms_cu mod_obj = ppms.get_target_module() target_mod_id=ppms_cu.Helper.get_global_setting("Python_ID_Projektdatenblatt").alpha120.get_value() dialog_id=ppms_cu.Helper.get_global_setting("Python_ID_Dialogmeldung").alpha120.get_value() #Definition of a list containing all the marked records in the project data area. #When no record is marked, this list is blank. marked_records = ppms.get_context_df().get_record().get_da().get_marked_records() #Definition of new blank list project_list=[] # Is at least one record available in the "marked_records" list # for everyrecord in this list the project ID is read and written into the "project_list" list. # Additionally, the project ID of the record on which the link was activated is written # into the list. if len(marked_records) > 0: for record in marked_records: cur_pr_id = record.pr_id.get_raw_value() project_list.append(cur_pr_id) project_list.append(ppms.get_context_df().get_record().pr_id.get_raw_value()) # If the "marked_records" list is blank, the project ID of the record on which the link was activated # is written into the list. else: project_list.append(ppms.get_context_df().get_record().pr_id.get_raw_value()) mod_obj.set_new_L_var(30, project_list) ppms.ui_message_id(dialog_id) if ppms.msg_pop().get_reply() == 1: mod_obj.open_module(target_mod_id) else: ppms.get_context_df().get_record().mark()
Python_ID_Projektdatenblatt
entry must be replaced by the value from the Python ID field of the global setting of the project data sheet.
Python_ID_Dialogmeldung
entry must be replaced by the value from the Python ID field of the newly created global setting of the dialog message.
Python_ID_Vorgangsdatenblatt
entry must be replaced by the value from the Python ID field of the global setting of the task data sheet.
from ppms import ppms_cu mod_obj = ppms.get_target_module() # Definition of the module and dialog message ID target_mod_id=ppms_cu.Helper.get_global_setting("Python_ID_Projektdatenblatt").alpha120.get_value() dialog_id=ppms_cu.Helper.get_global_setting("Python_ID_Dialogmeldung").alpha120.get_value() target_task_mod_id=ppms_cu.Helper.get_global_setting("Python_ID_Vorgangsdatenblatt").alpha120.get_value() marked_records = ppms.get_context_df().get_record().get_da().get_marked_records() pr_id = ppms.get_context_df().get_record().pr_id.get_raw_value() pr_list = [pr_id] if len(marked_records) > 0: for record in marked_records: cur_pr_id = record.pr_id.get_raw_value() pr_list.append(cur_pr_id) mod_obj.set_new_L_var(30, pr_list) ppms.ui_message_id(dialog_id) if ppms.msg_pop().get_reply() == 1: pr_mod_obj = mod_obj.open_module(target_mod_id, forced_status=1) # Open the task data sheet task_mod_obj = pr_mod_obj.open_module(target_task_mod_id, forced_status=2, dock_to_module = pr_mod_obj.get_uid(), foreground=0, focus=0) # Execute the "get_tasks" method with the "pr_id" transfer parameter # This method is defined in the next module in the task data sheet. task_mod_obj.get_tasks(pr_id) else: ppms.get_context_df().get_record().mark()
get_tasks
method is defined, which writes the tasks of the project specified with Milestone = 2 to a list (task_list).
Select DI001098 FROM DT463 WHERE DI001097='{0}' AND DI006786='{1}'
SQL-Statement-ID
entry must be replaced by the value from the Statement field of the newly created statement.
# Definition of the get_tasks method def get_tasks(pr_id): value=2 sql_query=ppms.get_query("SQL-Statement-ID").format(pr_id,value) sql_query_result = ppms.db_select(sql_query) task_list=[] for record in sql_query_result: task_list.append(record[0]) mod_obj.set_current_L_var(11, task_list) mod_obj = ppms.get_target_module() def on_load(): # Provides the "get_tasks" method for the module object. od_obj.get_tasks = get_tasks def on_initial_focus(): mod_obj.menu(12) def on_focus(): pass def on_reset(): on_initial_focus() def on_before_mv_switch(old_mv, new_mv): pass def on_after_mv_switch(old_mv, new_mv): pass