Can I have some scripting examples please

Afternoon everyone,

In my solution I’d like to hide the status toolbar and make the user navigate and enter/edit data by means of scripts only.

So I’ve been googling for example scripts. They’re tough to find, but most probably I’m searching with the wrong terms. Voicing what I’d like Filemaker to do I can, but translating this into script steps is hard (at the moment), but I hope to learn. I was wondering if the community could supply me some example scripts.

What I would like to achieve is the following.
User is on a layout of an invoice header. On the same layout is a portal with the invoice lines.
Instead of inserting/editing or deleting invoice lines directly into- or from the portal, I have thought of the following.

New portal row
User clicks button called ‘New Invoiceline’. (there may be no invoice lines in the portal yet, so this button is always visible)
Filemaker opens a card window (and keeps it open until OK-button or Cancel-button is clicked)
User types data into fields; then
a) User clicks OK button; Record is committed; Card window closes; Filemaker returns to the original layout; The just committed invoiceline is shown in the portal.
b) User clicks Cancel; Record is not committed; Card window closes; Filemaker returns to the original layout. The portal has not changed.

Edit portal row
User clicks button called ‘Edit Invoiceline’ (the button will only appear if a row is selected in the portal)
Filemaker opens the same card window as above (and keeps it open until OK-button or Cancel-button is clicked)
User edits the data in fields.
a) User clicks OK-button; Record is committed; Card window closes; Filemaker returns to the original layout; changes are reflected in the portal row.
b) User clicks Cancel-button; Record remains unchanged; Card window closes; Filemaker returns to the original layout.

Delete portal row
User clicks button called ‘Delete Invoiceline’ (the button will only appear if a row is selected in the portal)
Filemaker opens dialog asking if the user is sure he wants to delete this line
a) if confirmed; close dialog; delete record
b) if canceled; close dialog
Filemaker returns to the original layout.

Above shows how I’d like Filemaker to behave when these actions are initiated by the user. Of course in-between steps also take place, like e.g. recalculating summaries in the invoice header when invoice lines are added, edited or deleted, but I think I can get these to work if not taken care of automatically already by Filemaker.

Sunny regards,
Maurice

You might want to check out some introductory FileMaker videos on LinkedIn or get an FMP book (not sure there are any current ones...). There may be some script examples online also.

Maybe this is good also?

https://www.fmtraining.tv/

1 Like

Hi @MauriceD,

Your explanations are pretty clear, thank you for that. The answer is not easy to put in text, it is something that is likely best suited for mentorship / consulting.

If you want to achieve this by yourself, I would recommend looking into transactional scripting. Todd Geist has published some good content on that. Also, the karbon framework (still by Todd and his team), is implementing transactional scripting and is open source, free to download on github if I remember correctly.

Alternatively, it could be easier for you to create some global fields matching your existing fields and use those to interact with the user before applying or canceling.

Feel free to reach me in a private message if what I say here is not clear enough.

Hope this helps...

1 Like

Adventures in FileMaker #2 by Phil Caulkins is a great example file/tutorial.

1 Like

@Cecile Maybe I don't see what you see, but I do not see a sample in that file that match the description from above. Is there something hidden somewhere?

it's a library of scripts - not in the context of the OP, but quite a 'library'

btw... Does anybody know if Phil is still around and all goes well?

2 Likes

Thank you Cecile.
The file you suggested is chock full of very useful and insightful examples.

2 Likes

Hi, I hope it is not a duplicate to Cecile"s file and fits the requirement of OP.

Adventure 1 CVLs.fmp12 (1.3 MB)

I reached out to him on Facebook. Maybe you could as well...

2 Likes

I found Phil’s file super helpful when I was trying to get my bearings with scripting.

Phil is wonderful. He was so patient with all my newbie FMP questions years ago. It's too bad we don't hear from him anymore on the forums.

4 Likes

@MauriceD How is everything? Were you able to achieve what you wanted?

2 Likes