Careful. There is an Execute SQL script step and an ExecuteSQL function. From the screen shot, you are using the Execute SQL function.
How do the two variables, $Stage and $$CurrentFitureID get values? I can see that $Stage is passed as a parameter but what did you put in the optional script parameter box to pass that value to this script?
Is there any global field involved in the expressions that assign values to either of these variables?
Is this script performed from a server schedule on the server?
You might want to either use FileMaker Advanced's debugger and data viewer or add a show custom dialog to check the value of this variables when you test your script on the server.
Derp, yes, i meant function.
Sorry the image has been updated. I was trying the global variable during my testing but went back to the $Figure_ID variable that is set in the same way as $Stage. These are set earlier in the script.
no global fields involved.
triggered from a button in both cases
i did use the data viewer, and all the variables come up exactly the same, but on the local version it gives the correct result and on the hosted version it gives ? I've attached a screenie of the dataview from the local side here, and the hosted in the next post
Here's when i run the same script on the same record, but from the hosted version
That question mark result indicates a syntax error with your SQL. I can't see why that would be the case for the hosted file and not on the local file. Can't help thinking that the hosted file's data model is different in some way such as a field or table with a different name than that on you local copy.
i went and double checked the table names on the relationship graph. this morning i had also updated the ApprovalLog table name, and had not updated it on the hosted version. Thank you for that suggestion! I've been battling this for an hour. Doh!