Database Reference
In-Depth Information
2. Add a Go to Record/Request/Page step below Go to Layout . Make sure First is
selected in the Specify pop-up menu .
You want to make sure your loop starts with the first record in your found set. These
first two steps are common preparation for starting a loop.
3. Add a Set Variable step below Go to Record . Name the variable 12qw111 and
then set its value to 0 .
This variable will add up hours as it loops through the found set of timeslip records.
Creating a variable and then setting its value to 0 is called initializing a variable .
4. Add a Loop step below the Set Variable step .
You also get a matching End Loop step. The next few script steps will go between this
pair.
5. Add a Set Field step as the first step of your loop. The target field is
Timeslips::Line Item ID , and the calculated result is $lineItemID .
When you put a Line Item ID into a timeslip record, you're relating the Line Item and
Timeslips tables. With the right TOs, you can look at any timeslip record and see any
line item related to it, and you can look at a line item record and see any timeslip re-
lated to it. You'll use this relationship later on to move data without switching layouts.
6. Add a Set Variable step below the Set Field step. Name the variable
$totalHours and then set its value to $totalHours + Timeslips::Duration .
The script will add the hours worked on each timeslip record to the value that's
already in the variable. On the first record, the variable will have 0 in it, so the result
of the first calculation will be the same as the duration. But every time the loop runs
again, the value in the variable will increment by the amount in the current record.
7. Add a Go to Record/Request/Page step after the Set Variable . Specify Next in
the pop-up menu and then select the “Exit after last” option .
Now the script goes to the next record in the found set. It exits the loop automatically
after it performs the looped steps on the last record. The rest of your script steps will
go after the comment following the End Loop step.
8. Add a Go to Layout step below the End Loop step. Set it to go to the Line Items
layout .
You're putting the data you gathered into your new line item record, so make sure
you're back on the Line Item layout.
Search WWH ::




Custom Search