Evaluate an expression in a string
In RAP, is there any way to obtain the result of an expression stored in a text field?
For example, in the CALC_ITEM field I have the formula:
PRC - VLR_1 + VLR_2
The PRC, VLR_1 and VLR_2 are fields from another table and I need to obtain the result of the formula above (which changes depending on the customer's classification).
Is there an expression evaluator that can be used directly in RAP and that recognizes the values of the fields (or variables that would be initialized with the values stored in the fields)?
For example, in the CALC_ITEM field I have the formula:
PRC - VLR_1 + VLR_2
The PRC, VLR_1 and VLR_2 are fields from another table and I need to obtain the result of the formula above (which changes depending on the customer's classification).
Is there an expression evaluator that can be used directly in RAP and that recognizes the values of the fields (or variables that would be initialized with the values stored in the fields)?
Comments
ReportBuilder does not have any built-in feature to extract field values from a text string and evaluate them as an expression. The closest thing we have to this is the Mail Merge feature of the RichText component and that requires special syntax to function. You would need to create a routine that parses the expression yourself and make the calculation as needed.
I found a few examples of this online and it appears the JCL offers an expression parsing solution.
https://stackoverflow.com/questions/572796/best-algorithm-for-evaluating-a-mathematical-expression
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com