Traversing through portal line item
I am very new in File Maker Pro. Trying to learn it. But recently i have encountered a problem. I wanted to make very simple script. I have made a layout with portal in it and a button. A script is attached to the button. When all the required data has been putted. Client will press the button to trigger the script.
A script will simple traverse through the line items and update the inventory.
Here is what i have written in the script.
"Go to Portal Row [First]
Set Variable [$id; Value:Sale Detail::_fkproductID]
Set Variable [$qty; Value:Sale Detail::Quantity]
Exit Loop If[$id=User Prefrences::null]
Perform Find [Specified Find Requests:Find Records; Criteria:Sale Detail::_fkproductID: “== $id”] [Restore]
Set Field [Product::ProductInStock; Product::ProductInStock - $qty]
Go to Layout[original layout]
Go to Portal Row [Next]
Kindly help me fix it.