Not without seeing your 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.
- 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. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
Here is the button setup...
Here is the Script...
That shows the name of the script you've selected, but not the script itself. You'll need to open that script in a script editor and capture that screen image. From the above dialog, you can pull down the "gear" drop down and select "edit". Or you can find the same script in Manage Scripts and double click it.
I duplicated the original layout.
I modified the new layout to reflect the correct table.
I duplicated the original script and modified it accordingly to reflect everything correctly.
In button setup I chose the new script to be run (let's call it Script A)
What happened before not surprisingly happeded again, i.e., the original layout displayed, I clicked Script A in the scripts menu and was presented the new layout.
Why is the original layout presented such that I have to choose the new script to get the new layout displayed?
I will gladly email my database to someone if they would like to take a closer look.
Keep in mind I am self-taught, newbie, hobbyist.
My database will eventually contain names and addresses for my personal use.
I choose my database as a starting point on how to learn and utilize FileMaker Pro 12 Advanced.
What is the name of the original layout?
What is the name of the new layout that you created by duplicating it?
This may be too obvious, but I've got to ask it to be sure: What names did you give the original and new scripts?
Do you have any script triggers defined in Layout Setup... for either of these two layouts?
Since you have FileMaker Advanced, I suggest enabling the script debugger and running your script. This way you can watch your script and step through it one step at a time. If any script triggers are tripped by this script, they will also pop up in the debugger window and if this happens, chances are that you've found the reason for the unexpected script results.
I ran the Script Degugger as you suggested. Note: This is my first use of the Script Debugger.
I'm assuming the top item in the Call Stack List Box, i.e., State Definitions — All is the last step to be acted upon?
Note: State Definitions — All is the layout which displays when the button is clicked which requests the CSZ Definitions — All layout.
Am I right in assuming the CSZ Definitions — All layout may go by so fast it is not even discernable?
So when I edit the script CSZ Definitions — All you see it doesn't contain anything about the State Definitions — All layout.
However the script State Definitions — All shows it when the script debugger is activated.
How did State Definitions — All get in the mix? It doesn't show up when I edit the script?
Should I just delete the CSZ Definitions — All script and just hand enter it instead of copying and pasting the steps I took from State Definitions — All script?
From what I see, you have more than one script in your call stack.
The call listed on the top of the stack is the one currently executing. I can't get something that looks like your screen unless I click on the bottom line of the call stack.
Yes, a script can change layouts so fast that you don't see anything on the screen when it happens.
It looks like your script is tripping a layout based script trigger on the layout. I'd open layout setup and examine the settings on the script triggers tab to see what is found there.
Are you sure that this screen shot is from clicking the Button? I get a a different icon that shows that script was performed from a button click.
The problem was in the script triggers.
I'm not sure why but I managed to set a script trigger in my initial report layout which I then used as a template.
As a consequence the script trigger was propogated in all the other report layouts.
I hadn't set a script trigger in the layouts used to maintain my tables so there was no problem there.
I learned two things today.
To make use of the script debugger and the impact of script triggers.
Thanks for all your insight.
There are two approaches you can use to avoid having a script "trip" layout based script triggers:
1) Set up a "hidden" trigger free utility layout. This can be a completely blank layout in most cases, but based on the same table occurrence as the layoutwith the trigger you want to avoid. Your script freezes the window and changes to this hidden layout (Not listed in the layouts drop down.) instead of the one with the trigger. Please note that if the trigger is an OnLayoutExit trigger or an OnRecordLoad trigger set on the layout you are starting out from, this method can't be used.
2) Use a global field and careful coding to "turn off" your triggers when you don't want them to be tripped by your scripts.
Put every layout script trigger controlled cript inside this If block:
If [Not $$TriggersOff ]
#Put the rest of your script here
For every script that might trip such a trigger when you don't want it to:
Set Variable [$$TriggersOff ; value: True ]
Go to Layout
Set Variable [$$TriggersOf ; value: False ]