If you are in the Invoices Starter Solution and you go to the Invoices Layout. Then you go in Layout mode ( Edit Layout ).
Now you can go into Layout Setup "Layouts" - "Layout Setup" and you can go to the "Script Triggers" tab to see the script is set on the "OnRecordLoad" Event.
Apparently this is a script that is performed every time a record is loaded.
Easiest thing to do if you have FM advanced, it to open up the script debugger and data view and watch what happens step by step. That button is most likely attached to a script, that takes you from a view only layout to a layout where you enter data.
In Layout mode, right click on the button, click 'Button Setup'. You'll see a list of scripts, pick your script. In your case you can click the little + sign, and create a new script:
Go to Layout [hard code your data entry layout here]
If this is a button you need on multiple layouts you can create one script. A good naming convention helps here.
Suppose your tables are named:
And you layouts are
Your script could be something like:
Set Variable [$a; Value: leftwords(get(layouttablename);1)
Go to layout [$a & "_dataentry"]
New Record Request.
Edit: Hey Guy....long time no see.....
Edit: Hi Steve, I do hang out here from time to time :)
Maybe you missed this but the idea is not to use a button on the layout but to use Filemaker's own "New Record" button. As mentioned in the original post. And as you can see if you use the Invoices starter solution.
Because with a button on the layout this would indeed be pretty simple.
I did miss that. I didn't upgrade yet. I just thought it was a button called 'New Record' on a starter solution and took a guess.
Oh, you should upgrade to Fm 14. The Script Workspace is a hoot :)
The problem is I'm on 12. If I upgrade, I am going to want to completely redo my work database with popovers, slide controls, button bars,etc., and I just don't have the time as my business is just starting to ramp up for my busy season. Soon....
Hehe, I know how you feel.
We are upgrading one database from FM 11 to 14.
I can't wait to add pop overs, button bars, barcode scanning, iPad layouts etc. :)
Thank you for your prompt response. I looked at the use of the trigger script and applied it to the 'OnrecordLoad' event. However what actually happens is that even before the 1st layout is displayed it invokes the 'OnrecordLoad' event.... It feels as though the trigger / script should be associated with the pressing of the 'New record' button - but I don't see how this works?
Am I missing something fundamental here ?
I have got it working..... I had not included the 1st step of the code which checks the record open state !!!
I am new to this and not a coder - so its going to take a bit of time to get my head around the technicalities...
Many thanks for your help. Jonathan