Execute in an execute

Is it allowed to have an execute statement with in an execute statement?

Just tried:

execute |||execute {message "OK"} message "YEP"|||

Both messages appeared so I guess you can do it for whatever the reason is you might have. :confused:

Hi Gary

Sorry it’s been a while but I was trying to use this in a arraybuild statement along with formula merge and for some reason I couldn’t get it to work

I am basically trying to merge data from an array build in the database with a web template. So does formula merge work in an array build statement I’m not around where I can post the code I’ll do that maybe later today

Formulamerge is a statement so it can not be used in a formula within an arraybuild statement.

Hi Gary,

Does a lookupall( work in arraybuild( or arrayfilter(?

And, other than experimenting, how can I tell if lookupall( would work? Is there a rule that you can’t use a statement with a statement or a function with a function?

Thanks

Experimenting is almost always the way I test things even to answer someone’s question on the forum. Statements can use functions as part of their parameter formulas and these functions can also have other functions daisy-chained within them as well. Statements can never contain other statements - never. Functions can not stand alone in a procedure as a separate line of code - never. In the Formula pane of an object you can have standalone functions but that is because they are part of a formula used to determine some content in the object.

Any function should work as a parameter for any other function. There have been instances where that was not the case but that is a bug.

Keep in mind, however, that various lookup( and arraybuild( functions work by scanning entire databases. If you use a lookupall( function inside an arraybuild( then you’ll be doing two levels of database scanning. Suppose that you are using arraybuild( on a database of 10,000 records, and inside that a lookupall( of a database of 5,000 records, the formula will wind up scanning 50 million records each time it is calculated. That might take a while!

Thank you Jim,

I think I will adjust my approach and avoid scanning 50 million records. :slight_smile: I appreciate the heads up on that.