FileMaker Pro 11 · FILEMAKER FUNCTIONS REFERENCE 3 Contents Aggregate functions Average ...
FileMaker Scripting Best Practices
-
Upload
db-services -
Category
Technology
-
view
1.197 -
download
7
Transcript of FileMaker Scripting Best Practices
![Page 1: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/1.jpg)
SCRIPTING BEST PRACTICESEmory BrownApplication Developerhttps://www.dbservices.com
![Page 2: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/2.jpg)
Questions
If you have a question, please typist it into the console. If we
don’t get to your question, please send it to [email protected]
![Page 3: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/3.jpg)
About You
![Page 4: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/4.jpg)
About DB Services
•We are a team of analysts, developers, and designers creating custom applications to make your organization more effective and efficient. Learn more about our FileMaker services on our website.
•If you leave this presentation wanting learn more! Check out our FileMaker Blog where we post new content each month.
•To learn more about DB Services, check out our website at www.dbservices.com
![Page 5: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/5.jpg)
Background
Work
Read more on me on our website, https://www.dbservices.com/, in the About section
• Application Developer atDB Services
• Certified in 15, 14,13, 12, 11• Working with FileMaker for 6 years• Sponsor at FileMaker Developer
Conference
• Member of FM Academy• Global presence (Canada, Europe,
Africa, South America)• Team focused on adding value
![Page 6: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/6.jpg)
Scripting
When coding, choose two:• It works• Easy to read• Quick to write
Conventions help make code that works, faster to read and write.
![Page 7: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/7.jpg)
Time Saving
Humans are the most expensive part of theapplication development cycle. • Template• Conventions• Scannable Code
![Page 8: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/8.jpg)
Proper Context
Ensure script is run from intended contexts• Saves time testing• Create fewer bugs• Generic scripts
![Page 9: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/9.jpg)
Error-Trapping Scripts
Three useful sub-scripts to consider in every script• Halt of not in browse mode• Halt if no records in found set• Commit record and halt if invalid*
![Page 10: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/10.jpg)
Error-Trapping
Why Error trap?• Empower users• Speed up troubleshooting• Create user trust
**Don’t make generic error messages
![Page 11: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/11.jpg)
Allow User Abort [Off]
Doesn’t make sense for users to be able to escape a script.
![Page 12: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/12.jpg)
Set Error Capture [On]
Detailed error messaging empowers the user andhelps the developer troubleshoot
![Page 13: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/13.jpg)
Exit Script Step
![Page 14: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/14.jpg)
Error-Trapping
What to trap for• New Record• Delete Record• Set field• Go to related record*• Interacting with systems outside of FileMaker
![Page 15: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/15.jpg)
Commenting
Not all comments are created equal• Readability• Clarity• Scannability
![Page 16: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/16.jpg)
Commenting
Readability• Housekeeping• Section Headers• Spacing• Notations
![Page 17: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/17.jpg)
No Comments
![Page 18: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/18.jpg)
Minimal Spacing
![Page 19: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/19.jpg)
Too Many
![Page 20: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/20.jpg)
Clear Sections
![Page 21: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/21.jpg)
Commenting
Clarity vs Noise• Anything being used in a non-
conventional way*• Stacked objects• Sort script steps*
![Page 22: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/22.jpg)
Hidden/Stacked Objects
![Page 23: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/23.jpg)
Commenting
Most important thing is DOING IT• Update comments as you code• Create a template script with
sections
![Page 24: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/24.jpg)
Modular Code
Pros & Cons• Can save time testing or updating• Can also add time to later updates• Don’t over-engineer
![Page 25: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/25.jpg)
Too Much
*Inconsistant
![Page 26: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/26.jpg)
Too Much
![Page 27: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/27.jpg)
Complex Code
![Page 28: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/28.jpg)
Ziptastic API
![Page 29: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/29.jpg)
Evaluate
![Page 30: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/30.jpg)
Evaluate
Dangers of Evaluate( )• Tempts you to hardcode field names• Slower than native code• Security risks
![Page 31: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/31.jpg)
Tips & Tricks
Script Debugger• Step-Into debugger• Turn off script trigger button
![Page 32: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/32.jpg)
Naming Code
How to name variables well• Self-describing noun• Unique name• NO right answer
![Page 33: FileMaker Scripting Best Practices](https://reader030.fdocuments.us/reader030/viewer/2022021420/5879ace41a28ab6b2c8b484b/html5/thumbnails/33.jpg)
Q&A