Jump to content

Evaluate function

This topic is 6128 days old. Please don't post here. Open a new topic instead.

Recommended Posts

does anybody know why below evaluate function require back slash between a+1 & b+2 ? it wouldn't work without it. and i noticed that in let calculation , "&a+1,b+2&" will work.

why do i must use back slash in evaluate calc and not in a let calc ?

calc =

Evaluate ( "Let ( [ " &"A=5 , B=10"& " ] ; a+1 & ", " & b+2 )" )



Link to comment
Share on other sites

You're still missing some backslashes here and there... the point is that everything inside the evaluate quotes is regarded a string ... but if a quote comes along the way, is it a Evaluate( end mark or is it just the arrival of a text string inside the actual calc ...every arriving quote along the reading direction that means somethng for the calc' should be backslashed.

Indeed utterly confusing until you work methododically with the flow in the string!


Link to comment
Share on other sites

Hi Kyle,

Evaluate evaluates a string that you provide as if it were a real expression. Lets pretend you have two fields for a second. Field one is a text field called "expression" field two is a calc field called "result":

Create a new record and dump this into your expression field: Let( A = 5 ; a + 1 )

Now, for your result field, simply reference your text field (i.e. table::expression) and do nothing else.

What you're result field will return is the exact same string that you provided it with: Let( A = 5 ; a + 1 )... note that the string has not been evaluated because it is a STRING and while it resembles an expression, the calc engine doesn't see it as one.

Now, go back to your result field and enclose your field reference in Evaluate tags: Evaluate( table::field ).

Note the output.

Even though you are providing a string, Evaluate is processing the string as if it were an expression you had placed directly in via the calc engine.

Now, for the evaluate function to work properly you have to understand that it is expecting a string (i.e. "text" or field contents), not an expression entered directly in via the calc dialog.

Let's go back to our example again...

The contents of the field is return as a string so Let( A = 5 ; a + 1 ) in a field is exactly the same as "Let( A = 5 ; a + 1 )" in a calc dialog.

Anyway, the point of evaluate is more to evaluate varying expressions or otherwise construct dynamic expressions.

From the example you've given I think you may be misusing it (always helps to have more information) - If all you wanted to do was add the above to your variables then you would just go:

Let( [ A = 5 ; B = 10 ] ;

a+1 & ", " & b+2 )

Link to comment
Share on other sites

In relation to your question though: if you wanted to actually use a literal string inside an evaluate expression you have to remember that the Evaluate expression will try to evaluate the entirety of the string you give it, to let it know you actually want to incorporate a normal string you would have to enclose in quotes without breaking the expression string i.e:

"Let( [ A=5 ; B=A+5 ] ; "A = " & A & ", B = A+5 =" & B )"

Which would look like the following to the evaluate function:

Let( [ A=5 ; B=A+5 ] ; "A = " & A & ", B = A+5" & B )


Link to comment
Share on other sites

This topic is 6128 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.