Database Reference
In-Depth Information
5.
From the “Find records when” pop-up menu, choose Expenses and then click the
Line Item ID field
.
The selected field is now highlighted.
6.
Click the Insert Operator button and then choose “= match whole word (or
match empty)” from the resulting menu. Click the Add button. Click OK and
then click OK again to get back to your script. Or enter
=
.
Just as the menu says, an equals sign, used alone, tells FileMaker you want records
where the Line Item ID field matches
nothing
. These are all your expenses that
haven't been billed.
7.
Add the
Set Field
script step to the script and then turn on the “Specify target
field” checkbox. Select the Expenses::Job ID field and then click OK
.
The step should appear after the
Enter Find Mode
step. If it doesn't, move it there
now.
8.
Click the Specify button to the right of “Calculated result.” In the calculation
box, type
“==” & Get(ScriptParameter)
. Click OK
.
This calculation puts the Job ID (from the script parameter) into the field, with
“==”
before it, telling FileMaker you want to find records that match this ID exactly. Added
to the find request above, the script finds unbilled activity for the current job.
9.
Add the
Set Error Capture
script step to the script and then make sure its
“On” option is selected
.
You're about to perform a find, and you don't want the database user to see an error
message if there are no unbilled expenses.
10.
Add the
Perform Find
script step to the script
.
The script step belongs below the
Set Error Capture
step. Make sure you don't se-
lect
Perform Find/Replace
by accident.
11.
Add another copy of the
Set Error Capture
step to the script, this time with the
“Off” option selected
.
You can select the existing
Set Error Capture
step, click the duplicate button, then
drag the new step into place and then set the option to “Off.” Once the
Perform Find
step is finished, you want FileMaker to stop capturing error messages.
12.
Add a
Set Variable
script step below
Set Error Capture [Off]
.
Name the
variable
$unbilledItems
.
Set its value to
Get(FoundCount)
.
Save the script
.