Want to Minimize the Script Node number.

Hey All.

I have requirement to manipulate the process variables receiving in process model as a parameter. I am using 3 script task node to manipulate the PV ,as the output of 1st node is using in 2nd node and output of 2nd in 3rd node.  Can I minimize that? Because I want that the  process model takes very less time to execute(performance should be good).

See the below scenario:

1st Script Task Node:-  Expression= cond(pv!a)     Output:- pv!op1

2nd Script Task Node:- Expression= cond(cond(pv!op1))     Output:- pv!op2

3rd Script Task Node:- Expression= rule!ABC(cond(pv!op2,cond(pv!op3)))     Output:- pv!op3

 

Thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    If the only PV you require at the end is pv!op3 (in other words, you don't actually need to keep any values in pv!op2 or pv!op1), then  's idea is the best bet. In fact you can even use local variables in an output expression in a script task, without necessarily even creating a new expression rule.

    /* For Example... */
    
    with(
      local!op1: cond(pv!a),
      local!op2: cond(cond(local!op1)),
      local!op3: rule!ABC(cond(local!op2)),
      
      /* return output from local!op3 */
      local!op3
    )


    Also I will say, just for the record: having 3 script tasks instead of 1, when the work being done is approximately the same amount, will not make any meaningful difference in the process runtime. I do support consolidating nodes, but don't expect any performance increase from this.

Reply
  • 0
    Certified Lead Developer

    If the only PV you require at the end is pv!op3 (in other words, you don't actually need to keep any values in pv!op2 or pv!op1), then  's idea is the best bet. In fact you can even use local variables in an output expression in a script task, without necessarily even creating a new expression rule.

    /* For Example... */
    
    with(
      local!op1: cond(pv!a),
      local!op2: cond(cond(local!op1)),
      local!op3: rule!ABC(cond(local!op2)),
      
      /* return output from local!op3 */
      local!op3
    )


    Also I will say, just for the record: having 3 script tasks instead of 1, when the work being done is approximately the same amount, will not make any meaningful difference in the process runtime. I do support consolidating nodes, but don't expect any performance increase from this.

Children