AnsweredAssumed Answered

Manipulating portal rows

Question asked by AntonChuykin on Nov 19, 2010
Latest reply on Nov 21, 2010 by AntonChuykin


Manipulating portal rows


Dear Colleagues,

Could you please help me to show how can I manipulate portal rows via scripting.

Here is my quick story: I'm working on a purchase orders DB. Each my order is, at least, 1 up to 20 trucks of goods. I have a goal to track each shipment and a payment for it. I started this topic already Auto-add record on some event, but I did it in a wrong way. I tried to duplicate my current record into X records, where X is number of trucks. Later, I found this idea stupid (as well as Phil here), because it ruined or, ok, made it very complicated, to run reports then. 

Now I want to try to make it via portal rows. For instance, I prepare my PO and press button below, that will run a script. This script is to calculate total amount of trucks per order (this one is easy) and, what I don't know how to do, will make in a new layout X rows for each truck. 

Could you please lead me to a proper way of making this? Which relations should I make, how-to make this rows? Add record in this "tracking" layout? I tried it myself several times and ways and still can't do it in a proper way. Thank you beforehand. 

My current script looks like:

Set Next Serial Value [ Tracking.portal::tracking.portalSERIAL; 1 ]

Set Variable $tracking; Value:Tracking::trackingID ]

Go to Layout [ “Tracking” (Tracking) ]

New Record/Request

Go to Layout [ “Tracking.portal” (Tracking.portal) ]

Loop New Record/Request Set Field [ Tracking.portal::tracking.portalID; $tracking ]

Exit Loop If [ Purchase orders::transportCALC = Tracking.portal::tracking.portalSERIAL ] End Loop

Go to Layout [ “Tracking” (Tracking) ]

Layout TRACKING is layout that shows portal, TRACKING.PORTAL layout is layout with portal fields

Purchase orders::transportCALC is calculation that will shows how many trucks contains this order.

But it doesn't work at all. First, because Purchase orders::transportCALC doesn't show me related to main purchase order calculation, so it doesn't STOP when I need it to exit loop. This must be due to relations problem. I'm working on it. Second, this script doesn't add new records in my portal.