Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
FileMaker isn’t that great at internal documentation about schema (calculations, scripts and relationships). It is one of the key areas that I hope FileMaker will continue to approve upon as each new version comes out. In all fairness, I think they have made incremental progress in the area. In FileMaker 8, the good folks at FileMaker added something akin to a sticky note to document relationships internally. In FileMaker 7, FileMaker added a method to tag text strings as comments within calculations.
If you are like most FileMaker developers, you don’t document your code. That is too back because (at some future time) you will likely look at a complex calculation you created and stand agape in bewilderment. If you are inheriting a complex FileMaker project from another developer, schema comments can be a real life saver! This can be used as a reference to what the calculation does, just in case you need to come back to it weeks, months or even years later.
So, enough preaching in this discussion and I apologize for letting a small bit of my passion to peek out on the subject.
Comments within a calculation can be …
– a reference to what purpose a calculation serves
– a reference to details about how a calculation does, what is does
– a reference to when it was added or modified (and by whom)
– a record to show your previous calculation and the new one
With FileMaker 7 and higher, you can now place comments within a calculation. In fact, 2 different methods are supported.
/* Here is a text comment */
// Here is a text comment ¶
THE FIRST METHOD
The first example is used to show where the comment starts and where it end. The comment starts at the /* characters and ends at the */ character. This is most commonly used when commenting out a large calculation. This can be a calculation that you have that almost works but you want to start over fresh. You can put a few carriage returns at the top, enter in your new calculation, add a comment that the below calculation is an older version and finally comment out the entire old calculation.
So after it is done, you have your new calculation (working), your old calculation (disabled) and comments about the particulars!
THE SECOND METHOD
This is a quicker method of commenting, allowing you to preface a single row of a calculation with // and FileMaker will ignore that entire row. This is used primarily for quick notes a developer may make to himself/herself.
THE FILEMAKER 6 WORK AROUNDS .. Just in case you were curious, here is the scoop on the older FileMaker 6 and earlier workarounds for internal script commenting. There is no reason to use this method now but you might come across this when you are working with a converted FileMaker 6 solution.
Use a left or right text function that has it’s character count set to zero. This allows you to hide a text string inside a function that cannot calculate anything.
Left ( “ this calculation does blah, blah, blah”, 0 )
Right ( “ this calculation does blah, blah, blah”, 0 )
Another option is to use FileMaker External function capability, which is less confusing. Only a small percentage of all your calculations will use External functions unless you are extensively using plug-ins. So an external function like the one I show below might be a better option for you.
External(“CALC COMMENT”, “Put in a comment here!”)