AnsweredAssumed Answered

If value exist in portal, increase value by 1

Question asked by K.L on Aug 21, 2018
Latest reply on Aug 21, 2018 by sgljungholm

Hi All,

 

I've been stuck on trying to figure out how to write a script step, I'm hoping someone can help.  This is what I'm working on:

 

I have two portals on one layout.  First portal (Items) is a list of estimate items, second portal (Actual) is a list of actual items.  A button is created on the first portal to copy the row of estimate items if there are no changes to the second portal. I want the script to check the second portal if there's an order number already on the second portal to add the next value.  For example, If there's already a "1" in the order field in the second portal, it will auto generate number "2" in the order field for the row to copy over to the second portal and so on with number 3, 4,... for more rows to copy over to the second portal.

 

This is the script I currently have now, the script adds an order number starting with 2 and so on but I don't know how to have it start with 1 when there's no items in the second portal?

 

Script:

Go to Object [Object Name: "Actual"]

Go to Portal Row [Selection: On; First]

Loop

     Set Field [Items_Actual::Actual_Package#1; Items_Actual::Actual_Package#1 + 1]

Go to Portal Row [Select:Off; Next; Exit after last: Off]

Exit Loop If [IsEmpty (Items_Actual::Actual_Package#1)]

End Loop

 

Thanks

K.L

Outcomes