MihailCheie604746

Retrieving scheduling info with script

Discussion created by MihailCheie604746 on May 29, 2018
Latest reply on May 29, 2018 by MihailCheie604746

Hi all,

 


I am currently working on a script that can retrieve all the scheduling info of a given workflow and i have problems formating the result in a more user friendly way. I have created a JOBS object that uses a PRPT which prompts the user to enter the WF name.

 

Then the WF name is used as a variable for sereral VARA.SEC_SQLI objects that are retrieving data about that WF from AE DB.

 

The data gathered using VARA.SEC_SQLI is then processed with the following script and is displayed in the report of the run:

 

:SET &COUNT_CHECK_JOBP# = GET_VAR(VARA.SEC_SQLI.COUNT_CHECK_JOBP)
:IF &COUNT_CHECK_JOBP# <> 1
:PRINT "              The workflow name is incorrect or the workflow does not exist in this client"
:   PRINT "                                                                  "
:ELSE
:SET &count_sched# = GET_VAR(VARA.SEC_SQLI.COUNT_FIND_SCHED_AND_PERIOD_FOR_WORKFLOW)
:IF &count_sched# <> 0
:SET &HND1#=PREP_PROCESS_VAR(VARA.SEC_SQLI.FIND_SCHED_AND_PERIOD_FOR_WORKFLOW)
:PROCESS &HND1#
:   SET &Workflow# = GET_PROCESS_LINE(&HND1#,1)
:   SET &SCHED# = GET_PROCESS_LINE(&HND1#,3)
:   SET &START_TIME# = GET_PROCESS_LINE(&HND1#,4)
:   SET &DAYS# = GET_PROCESS_LINE(&HND1#,5)
:   SET &STATUS# = GET_PROCESS_LINE(&HND1#,6)
:   SET &period# = GET_PROCESS_LINE(&HND1#,7)
:   SET &WF_status# = GET_PROCESS_LINE(&HND1#,8)
:   SET &SCHED_STATUS# = GET_PROCESS_LINE(&HND1#,9)
:   PRINT "            WORKFLOW INFO"
:   PRINT "             - WF Name:    &Workflow#"
:   PRINT "             - WF Status:  &WF_status#"
:   PRINT "                                                                  "
:   PRINT "            SCHEDULE & TASK INFO"
:   PRINT "             - SCH Name:        &SCHED#"
:   PRINT "             - SCH Status:      &SCHED_STATUS#"
:   PRINT "             - SCH Frequency:   &DAYS#"
:   PRINT "             - TASK Start Time: &START_TIME#"
:   PRINT "             - TASK Status:     &STATUS#"
:   PRINT "                                                                  "
:   PRINT "            PERIOD INFO"
:   PRINT "             - Name: &period#"
:   PRINT "                                                                  "
:   PRINT "                                                                  "
:ENDPROCESS
:ELSE
:  SET &HND2#=PREP_PROCESS_VAR(VARA.SEC_SQLI.FIND_PERIOD_FOR_WORLFLOW)
:PROCESS &HND2#
:   SET &Workflow# = GET_PROCESS_LINE(&HND2#,1)
:   SET &Periods# = GET_PROCESS_LINE(&HND2#,3)
:   SET &WF_status# = GET_PROCESS_LINE(&HND2#,4)
:   PRINT "            --- Workflow &Workflow# is using the following period/periods "
:   PRINT "            --- Periods = &Periods#"
:   PRINT "            --- Workflow Status = &WF_status#"
:   PRINT "                                                                  "
:ENDPROCESS
:ENDIF

 

It works fine and retrieves accurate data but I would like to avoid repeating the WF Info section when a WF is part of multiple schedule objects and to not show the Period Info section if the WF doesn't have a period attached to it.

Would that be possible? and if yes, how can I achieve it?

 

Thank you for any input.

Outcomes