We had an interesting problem to solve which involved pulling data from the Lawson S3 GLTRANS table (based upon ObjID values). We wanted to pull 2000 records at a time and then trigger another instance of the flow to pull the next 2000, and so on, until all current records were captured.
We didn't want to work with two different versions of the flow, one with the beginning range value preset and one with it being passed from the Trigger. That meant we needed a variable assignment that would know when the variable existed and when it didn't.
So, on the Start node, when we defined the beginRange variable we used a particular function to create the variable when it didn't exist but to utilize it when it did.
In some programming languages, this is referred to as an 'immediate if' statement, meaning to validate it now. We couldn't simply tell IPA to set beginRange=beginRange because the system returned an error saying that beginRange is undefined (when it didn't already exist as a Trigger variable).
To solve this, we found a function typeof which would evaluate the variable, even if it was undefined. In fact, that is the answer we wanted in the immediate if. If beginRange was undefined then assign the zero value to it, but if it wasn't undefined then assign it to it's own value.
The last returned value in the query (which was set to &MAX=2000) will always the value we're looking for so we didn't need to reference the record number. This also has the advantage of not having to account for when the query returned less than 2000 records.
Having captured the first and last Obj ID values, we could use them later within the flow and for when we triggered the next instance of the flow. The lastObjId value from the current flow became the beginRange variable value used when the next instance of the flow was triggered.