Database Reference
In-Depth Information
You're grabbing data to put into the new line item record you'll be creating later in
this script.
6.
Add a
Set Variable
step. Name the variable
$amount
and then set its value to
Expenses::Amount
.
Grab all the data you need from Expenses before you leave the layout.
7.
Add a
Go to Layout
step. Set it to go to the Line Items layout
.
The context has to be right to create your new record.
8.
Add a
New Record/Request
step
.
It doesn't have any options.
9.
Add a
Set Field
step. The target field is Line Items::Invoice ID, and the calcu-
lated result is
Get(ScriptParameter)
.
You need to remember to set this script's parameter when you hook it up to the main
script later.
10.
Add a
Set Field
step. The target field is Line Items::Description, and the calcu-
lated result is
“Expense:” & $description
.
You have to include the quote marks since you want the calculation to set the static
text
Expense
: into the field and then add the contents of your
$description
variable.
11.
Add a
Set Field
step. The target field is
Line Items::Price Each
, and the calcu-
lated result is
$amount
.
The amount is how much you spent.
12.
Add a
Set Field
step. The target field is
Line Items::Quantity
and the calculated
result is
1
.
Don't include the quotes this time, since 1 is a number. You need the value so your
Extended Price can perform its math properly.
13.
Add a
Set Variable
step. Name the variable
$lineitemID
, and set its value to
LineItems::Line Item ID
.
You're grabbing the Line Item ID now so you can put it into the expense record next.
This step creates the relationship between the Line Item and Expenses tables, and it
ensures that the next time you run the script, this same expense record won't be found
again.
14.
Add a
Go to Layout
step. Set it to go to the Expenses layout
.