KBEC-00270 - Referencing Parameters in Sub-Procedures

Problem

When you have a parameter from the parent procedure, how can you reference it from a sub-procedure?

Solution

Use the /myParent reference to allow a sub-procedure to access the values of properties in the parent (calling) procedure.

When you supply input to a procedure (or sub-procedure), this information is stored in the job Parameter Sheet.

The following diagram shows three procedures that pass parameters to each other.  In the procedure called Procedure Bottom, the output of the command step is various properties from the job and parent procedure (Procedure Middle).

 
KBEC-00270x.png
The following is the output from the command steps in Procedure Bottom:

  • foo
  • foo_foo
  • bar
  • Procedure Top
  • Procedure Middle  

In Procedure Bottom command step, what are the results of the following steps?

  • echo $[/myJob/ParamB]
    Result:  PROPERTY_REFERENCE_ERROR       
    There is no ParamB on the Procedure Top job.
  • echo $[/myParent/myParent/procedureName]
    Result:  PROPERTY_REFERENCE_ERROR
    The command step does not have a chain of parentage. Only the parent does.

     

          Use /javacript getProperty instead:

          $[/javascript getProperty(getProperty(myJobStep ,"/myParent") ,"/myParent").procedureName;

           Result:       Procedure Top

We recommend that you create the previous procedures and test the various parameter commands to better understand the using the /myParent calls.

This information is from the Flow Advanced Training presentation.

Have more questions? Submit a request

Comments

Powered by Zendesk