reflous Posted June 25, 2003 Posted June 25, 2003 I have three tables, purchase_orders.fp5, po_lines.fp5 and inventory.fp5 The purchase_orders table has a portal of po_lines set by a relationship on the field po_id. I have written a script so when the items ordered from the purchase order are received, the user can hit a checkbox and activate a script within the portal row that should add that item into the inventory database. Everything works perfectly except that no matter which row is selected the first portal row is the one referenced (set field 'temp' by po_line by po_id:product_id). I assume this has something to do with the way I have my relationships setup. Ideas?
Ugo DI LUCA Posted June 25, 2003 Posted June 25, 2003 The way to go is to use a global field in the related file. Are you creating a record in Inventory ?!! The script in portal row could GotoRelated record (OrderToPoLines - show only) PerformExternal script (OrderToPoLines-(SetField, Global, Product_ID)) PerformExternal script (Inventory-Add Product) Refresh Script in Inventory "AddProduct Script" Create New Record Set Field (Product_ID, ::InventoryToPoLine:global) Now, if you're adding the quantity ordered in the Inventory "quantityOnHold", you could do it that way : GotoRelated record (POLines - show only) PerformExternal script (PoLines-(SetQuantities in inventory)) Refresh Script in POLines "SetQuantities in inventory" SetField, Global, Product_ID SetField, GlobalQuantity, Quantity Ordered GoToRelatedRecord (POLines:global::Inventory:Product_ID - show only) Perform External Script (Inventory-(Set Field(QuantityOnHold, QuantityOnHold+InventoryToPoLines::GlobalQuantity) Hope there isn't any error in this script...
reflous Posted June 26, 2003 Author Posted June 26, 2003 Thank you for the information but it didn't work. The reason is because my GotoRelated record is based on my relationship of po_id between purchase_orders.fp5 and po_lines.fp5. po_lines.fp5 has four records with the same po_id, so all four are returned and the values from the first record in the found set is used instead of the record selected in the portal.
Ugo DI LUCA Posted June 26, 2003 Posted June 26, 2003 Nope ! check back your GTRR script step. Show only must be checked
reflous Posted June 26, 2003 Author Posted June 26, 2003 Nevermind, I thought it worked, it still doesn't. Show only was already selected. It is strange, even though show only is selected, when I go to po_lines there are still 4 records found, but the record I care about is the one selected.
Ugo DI LUCA Posted June 26, 2003 Posted June 26, 2003 Post your script.... Must be some kind of obvious thing though. Make a test first. Add a small button. Attach this script : Go to related record (Your relationship to Po - Show Only) Click in any row and see where you are...
Ugo DI LUCA Posted June 26, 2003 Posted June 26, 2003 BTW, sorry if it sounds.... Your button must be in the Portal, not outside... Hmm.. Sorry for that one!
Ugo DI LUCA Posted June 26, 2003 Posted June 26, 2003 See attached a very simple demo of how you can update the inventory from a button in the portal. Well, the script isn't triggered when the update already happened. This could be changed though if you wanted to edit the quantity ordered afterwards. Open the PO file and click update in last portal row. Then create other orders or process other entries in the portal. iNVENTORY.zip
Recommended Posts
This topic is 7822 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now