Database Reference
In-Depth Information
You can use two different styles for your comments. First, any text that comes after two con-
secutive slash marks (//) is considered a comment. This kind of comment goes all the way to
the end of the line:
// this is a comment
3.14 * Diameter // and so is this
A comment is also any text that comes between the symbols /* and */. This symbol pair
comes in handy in two places. It saves typing if you need to type a long comment across
multiple lines:
/* this is a comment that runs across multiple
lines. To make life easier, you can use the second
comment style */
Also, this comment style lets you add comments within a line:
3 /*sprocket size*/ * 10 /*sprocket count*/ * 57 /*tooth count*/
In addition to comments, you can—and should—use white space to make your calculations
easier to read. Calculations don't have to be strung together in one long line, even though
that's the way FileMaker does it in the Specify Calculation window. Press the Return key or
the space bar to add space anywhere, except in a field name, function name, text constant, or
number. Comments and white space can make a world of difference. Here's a long calcula-
tion that doesn't use either:
Let([DaysToAdd=Case(DayOfWeek(theDate)=1;1;DayOfWeek(theDate)=2;0;DayOfWeek
(theDate)=3;-1;DayOfWeek(theDate)=4;-2;DayOfWeek(theDate)=5;-3;DayOfWeek
(theDate)=6;-4; DayOfWeek (theDate)=7; -5)];Date(Month(theDate);Day(theDate)
+DaysToAdd;Year(theDate)))
The calculation works just fine, but it's a nightmare to read and worse to edit. Here's the
same calculation, written with a comment and helpful spaces:
/*Figure out what day it is and then add or subtract the
proper number to the DayOfWeek value to identify This Monday.*/
Let ( [
DaysToAdd =
Case (
DayOfWeek ( theDate ) = 1; 1; // Sunday
DayOfWeek ( theDate ) = 2; 0; // Monday
DayOfWeek ( theDate ) = 3; -1; // Tuesday
DayOfWeek ( theDate ) = 4; -2; // Wednesday
DayOfWeek ( theDate ) = 5; -3; // Thursday
DayOfWeek ( theDate ) = 6; -4; // Friday
DayOfWeek ( theDate ) = 7; -5) ] ; // Saturday
Search WWH ::




Custom Search