I'd need to know a lot more. Please don't assume that I can remember previous discussions either.
I think you have:
Purchase Orders::PO_ID = POLineItems::PO_ID
Orders::Order_ID = OrderLienItems::Order_ID
But what represents a "matching order"? is there a link between Purchase Orders and Orders?
What I'm actually trying to do is run a script on the purchase order layout screen that goes to the Orders Layout Screen and looks through all the order line items from the Order Table and finds a match back in the Purchase Order, which are composed of loops. Somehow I'm not able to get it working. I will provide the script that I have and the screenshots of what's trying to happen.
Here is the Purchase Order Layout Screen where the Process PO Button Script Starts. It basically goes to the Orders Layout and goes through each Portal Row inside each order and goes through each portal row inside the purchase order where the Process PO started running.
Sorry, but a Migraine that isn't responding well to medication is making it very difficult to parse through all the details. Let's check my "big picture" understanding of what you want to do with this script first.
From a given PO record, you want to find all Order Line Item records from "new" Orders for each PO line item. They "match" if they have the same product ID?
If so, I wouldn't loop through records (and I try to avoid looping through portal rows if at all possible) to do this. It's possible to capture the needed data from your PO line items such that you can perform a find on an ORder Lineitems based layout, including criteria that specifies a "new" status for the related Order records. That avoids the need to do so much looping as you have here.
Spotted two possible issues with your current script:
You use Go to Portal row in your script but at least one layout has more than one portal. Note that there is no way to specify which portal you want to manipulate with this script. To make sure that Go To portal row refers to the correct portal, given the portal an object name and then use Go to Object to put the focus on the correct portal just before using Go to Portal row to specify a portal row.
You are computing a total in a field named: h_temp_quantity_older. Make sure that global storage is specified for this field, or better yet, use a variable instead of the field.