Evaluates a Boolean calculation and performs a conditional action based on that evaluation.
Specify the Boolean calculation you want evaluated.
Product | Supported |
FileMaker Pro Advanced | Yes |
FileMaker Go | Yes |
FileMaker WebDirect | Yes |
FileMaker Server | Yes |
FileMaker Cloud | Yes |
FileMaker Data API | Yes |
Custom Web Publishing | Yes |
Runtime solution | Yes |
FileMaker Pro 6.0 or earlier
If the calculation result is any number except zero, the calculation evaluates to true and the subsequent script steps are executed. If the calculation result is zero, no data, or does not resolve into a number, then the calculation evaluates to false and the subsequent script steps are not executed.
Every If step must have a corresponding End If script step somewhere after the If step and at the same indentation. Whenever you use an If script step, the script editing pane automatically enters an End If step.
You can also add additional conditions by using the Else If script step and Else script step.
•If you do not specify a calculation or if the calculation is unsuccessful, it will evaluate as false. Use the Get(LastError) function to capture these errors.
Performs a find. If no records are found, displays all records and sorts.
Perform Find [Restore]
If [Get (FoundCount) = 0]
Show All Records
Sort Records [Restore; With dialog: Off]
End If
Performs a find. If no records are found, displays a custom dialog box. If records are found, sorts the found set.
Perform Find [Restore]
If [Get ( FoundCount ) = 0]
Show Custom Dialog ["Find Records"; "No records were found."]
Else
Sort Records [Restore; With dialog: Off]
End If
Performs a find. If no records are found, displays a custom dialog box. If one record is found, goes to the Invoice Details layout. If more than one record is found, goes to the Invoices layout.
Perform Find [Restore]
If [Get (FoundCount) = 0]
Show Custom Dialog ["Find Records"; "No record was found."]
Else If [Get (FoundCount) = 1]
Go to Layout ["Invoice Details"]
Else
Go to Layout ["Invoices"]
End If
Performs a find. If no records are found, displays a custom dialog box so the user can run the Find Invoices script to search again. If one record is found, goes to the Invoice Details layout. If more than one record is found, goes to the Invoices layout.
Perform Find [ ]
If [Get ( FoundCount ) = 0]
Show Custom Dialog ["No Record Found"; "No records were found. Do you want to search again?"]
If [Get ( LastMessageChoice ) = 1]
#Calls this script again as a sub-script
Perform Script [Specified: From list; "Find Invoices" ; Parameters: ]
Else
Show All Records
End If
Else If [Get ( FoundCount ) = 1]
Go to Layout ["Invoice Details"]
Else
Go to Layout ["Invoices"]
End If
Sort Records [Restore; With dialog: Off]