Automic Workload Automation

 View Only
  • 1.  How to get the alias name of the parrent?

    Posted Dec 21, 2022 04:00 AM
    Sometimes we are re-using a sub workflow multiple times in a in larger workflow. E.g. like in this example of a TOP workflow, which has two instances of a SUB workflow. In order differentiate the two, we are using an alias for one of them:

    Within the task T4 (here also aliased to "ALIAS-OF-T4), I need to make use of the parents alias. Unfortunately, SYS_ACT_PARENT_NAME(), PARENT_NAME() and &$PROCESSOR# are returning the name of the object (SUB in this case) in the both T4 tasks, and not the name of the alias of the parent. Within the execution lists, you can see the correct alias names:


    Is there a was the get the alias name of the parent instead of the name of the object?

    Thanks,

    Christian



  • 2.  RE: How to get the alias name of the parrent?

    Posted Dec 21, 2022 06:55 AM

    Hi Christian,
    possible Solution, first get the Runid of Parent Workflow, and than select with GET_STATISTIC_DETAIL the Alias of this RUNID.


    :SET &ParentRID#=SYS_ACT_PARENT_NR()
    :PRINT &ParentRID#
    :SET &ALIAS# = GET_STATISTIC_DETAIL(&ParentRID#,ALIAS)
    :PRINT &ALIAS#

    Hope that will help, to solve the problem.

    Bye




  • 3.  RE: How to get the alias name of the parrent?

    Posted Dec 21, 2022 11:31 AM
    Hello,
    to get the alias of parent you only have to add a simple step and use another script function

    ! Get The Runid of the Parent
    :SET &ParentRID#=SYS_ACT_PARENT_NR()
    ! Print ist only for testing purpose
    :PRINT &ParentRID#
    ! here you can read the alias of the parent runid
    :SET &ALIAS# = GET_STATISTIC_DETAIL(&ParentRID#,ALIAS)
    :PRINT &ALIAS#

    Hope that will solve the problem.




  • 4.  RE: How to get the alias name of the parrent?

    Posted Dec 21, 2022 11:31 AM

    Hello,
    to get the alias of parent you only have to add a simple step and use another script function

    ! Get The Runid of the Parent
    :SET &ParentRID#=SYS_ACT_PARENT_NR()
    ! Print ist only for testing purpose
    :PRINT &ParentRID#
    ! here you can read the alias of the parent runid
    :SET &ALIAS# = GET_STATISTIC_DETAIL(&ParentRID#,ALIAS)
    :PRINT &ALIAS#

    Hope that will solve the problem.




  • 5.  RE: How to get the alias name of the parrent?

    Posted Dec 23, 2022 01:01 PM

    Hi Andrzej,

    thanks for this hint, I was not aware of this function yet, and it is working fine!

    In fact, I need to get an ID of the task by using the complete path. With GET_STATISTIC_DETAIL() the implementation is working and provides the expected path (TOP/ALIAS-OF-SUB/ALIAS-OF-T4):

    :set &__actName# = &$ALIAS#
    :set &__rid# = &$RESTART_RUNID#
    :SET &__top_wfl_rid# = &$TOP_PROCESSFLOW_RUNID#
    :set &__delim# = "/"
    :set &__path# = &__actName#

    :WHILE &__rid# NE &__top_wfl_rid#
    : set &__rid# = GET_PARENT_NR(&__rid#, PRC)
    : set &__actName# = GET_STATISTIC_DETAIL(&__rid#, ALIAS)
    : set &__path# = &__actName#&__delim#&__path#
    :ENDWHILE
    For reference, I also found another solution, by using an SEC_SQLI query (from our ORACLE DB):
    SELECT path FROM (
    SELECT SYS_CONNECT_BY_PATH(ah_alias, '/') path, AH_Idnr, ah_parenthir, CONNECT_BY_ISLEAF isleaf
    FROM (
    SELECT ah_alias, AH_Idnr, ah_parenthir, ah_topnr
    FROM ah a
    WHERE ah_otype<>'JSCH'
    START WITH AH_Idnr=?
    CONNECT BY PRIOR ah_parenthir = AH_Idnr
    )
    START WITH ah_topnr =0
    CONNECT BY PRIOR AH_Idnr = ah_parenthir
    ) WHERE isleaf=1

    You have to bind the 1st variable with &$RESTART_RUNID# (to be independent if the WFL has been restarted or not).

    Thanks a lot for your hint,
    Christian