cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

xPath eval function

Former Member
0 Likes
204

I am looking for a function in xPath that is equivalent to eval() in javascript.

Basically I have to fields in a database used for conversion

Operator --values can be * + - /

Amount --numeric value

I want to apply the operator and amount to a value inside a transaction.

Example.

Local.Operator = " * "

Local.Amount = 10

I am looping through tag values and want to dynamically apply the operator and amoun

Local.NewAmount = LoopValue Local.Operator Local.Amount

I want it to evaluate it to Local.NewAmount = LoopValue * 10

in javascript it is eval(LoopValue Local.Operator Local.Amount).

Any ideas how to do this in a transaction?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Why not just use the calculated columns action in BLS and/or dynamic references (#XXXX.YYY#) in your expressions? That should work. The dynamic references get replaced before the expression is evaluated.

Edited by: Rick Bullotta on Feb 14, 2008 1:53 PM

Former Member
0 Likes

Thanks for the idea, I will give it a try.

I also created a small transaction that just uses a switch statement based on the operator, and then adds, multiplies etc. Then returns the value. It works well for reuse, since multiple transactions need this funcitonality.

Just have to see which method works better.

Thanks again,

Jeff

Former Member
0 Likes

The dynamic expressions should be more performant, but the "switch" is probably more readable/understandable.

Better, Faster, Cheaper - Pick any two....

Or, in bike terms, Strong, Light, Cheap - Pick any two...

Answers (0)