Could you explain a little better exactly what you are trying to do?
1. Why do you want to copy all the line items? Are you trying to create an invoice or report?
2. After you copy them, (assuming you need to), then what do you want to do?
Your present script, if it works at all, will only create one variable, then make endless records setting the same variable.
We are a tuxedo store and sometimes for wedding parties the groomsmen wear the same thing. So instead of rewriting another invoice I would like to copy all the line items from one invoice to make a new one for the next groomsmen.
"Your present script, if it works at all, will only create one variable, then make endless records setting the same variable."
Yes I know this will happen I guess I was one wondering if there is a way for filemaker can almost determine how many Variables I need and then assign them a variable name
If 3 line items are present filemaker would make 3 variable $lineItemA; $lineItemB; $lineItemC (If there more line items it would make more)
Hope you can understand:)
See this script for duplicating a parent record and its associated child records:
Be sure to use the last version of the script found there, not the first one in the thread. No variable for a list of line items are needed.
If you want to build a list of line items in a single variable, you can use the following set variable step inside your loop:
Set Variable [$LineItem ; Value: List ( $LineItems ; "New Value Goes Here" ) ]
You can later use GetValue with a loop counter variable to access one value at a time from the resulting list. There are also ways to set up a repeating variable with a loop counter if you prefer an array to a list.