06-17-2015 02:14 PM
I am attempting to use a string parameter to contain a formula that, when passed into a called sequence, will populate the value of another string and be evaluated as a formula.
E.G.
CalledStep has:
a string parameter called Name,
a number local called Val, and
a message popup step with a precondition to only run if name equals Carl.
MainSequence :
is needs to pass in a formula for the parameter Name, so that inside CalledStep the name changes based on Val.
I have tried using "Parameters.Name = Locals.Val == 2? "+ Str("Carl") + ":" + Str("Jim") (with quotes as depicted), but it doesn't work. Watch view shows the equation in Parameters.Name but I suspect the quotes on the whole statement make it, just another string, instead of a working equation.
Is there a way, either in CalledStep or in the MainSequence to cause the above equation to be evaluated once inside the called sequence? Can I remove the quotes in CalledStep? Would I use an Expression (string) parameter?
Thank you for any help you can provide.
06-17-2015 04:19 PM
I didn't expect to figure it out myself so quickly, but I didn't want to wait until I'd wasted days already to post. Anyway, I have included a sequence file that accomplishes my goal and I hope it can help someone else out.
I used "Parameters.Name = Locals.Val == 2? \"Carl\" : \"Jim\"" to get the equation into CalledStep and then, once within, I used the evaluate command to look at the string as an expression. The result can then be stored in locals by equating two variables (i.e. locals.string = evaluate(parameter.name)), or by directly inserting it where I need the value.
06-19-2015 12:29 AM
06-19-2015 10:45 AM
It depends. If you want the quotation marks to remain in the Evaluate() function then you need the \" \" to keep the values between them as a string. If you want them as parameters, then the quotation marks are unnecessary. Also, if you are saving the formula in a string parameter you need and additional set of quotes around the whole formula, but if you are entering the formula into a sequence call parameter then you leave them off.
Thank you for replying.
Jason
06-19-2015 02:01 PM