"How to set the following variables?"
1) Set Variable [ $Original value; value: Get ( ScriptParameter ) ]
2) Set variable [ $New value; YourTable::YourField ] // if the script is fired by a field's trigger, you could use Get( ActiveFieldContent )
I still can't figure out how to set the original value to a variable
Use this script:
Set Variable [$$originalValue ; value: Get ( ScriptParameter ) ]
to save the original value. Need two $ to make it a global variable that will retain this value after the script terminates. Use onObjectEnter to perform this script and pass the field being entered as the script parameter. You'll find a box for this when you select a script for your script trigger.
2) in Raybaudi's suggested script can be performed by the ONOBjectSave trigger.
Anything to pay attention to if the field is a popup list? Still not working on $$original do u mean $$original can be used in other script too? even without mentioning it in that script?
"Still not working" doesn't tell us what you get when you try to use it. I suggest posting the actual script(s) that isn't/aren't working for you.
If you name a variable with two $$ it becomes a global variable accessible from any script/layout in the file. The value in it is retained until you close the file. Thus, one script--such as the one set to be performed via OnObjectEnter can set the variable to a value and then a second script, performed via OnObjectSave can access the value placed in that variable by the first script.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
I try my best to put my script here as I am using chinese interface. in the database I have a table as such: people 1 | people 2 | relation John. | Peter | supervisor peter. | John. | subordinate so the situation is to make sure if one changes Peter to Alex, the two records are updated my script is like this. as u suggested: Set Variable [$$originalValue ; value: Get ( ScriptParameter ) ]: set to onobjectenter of a popup field on the same field onobjectmodify I have a script like this: find[$$original in a table] but the find command returns no result but there is record containing $$original. it seems the original cant be capture by Set Variable [$$originalValue ; value: Get ( ScriptParameter ) ]
I see no script in you latest post.
Are you setting the script parameter in the optional Script parameter box in the dialog where you select the script for your OnOBjectEnter script trigger?