2 Replies Latest reply on May 9, 2013 3:43 PM by CStovin

    update button replaces all record portal fields not just active record

    CStovin

      Title

      update button replaces all record portal fields not just active record

      Post

           For a reason I do not understand when I click "Yes" to returning all equipment which is a field  ( ORDER::all_returned ) it places the current date in the Lines Portal field - Lines::return_date    -  all of the empty ones as a date can also be manually entered on a row by row basis....   But the all returned field is so I can enter the current date into many fields at once.

           It appears to work fine, but when I examine other  Work Orders with their own unique kp_order_id  their Lines::return_date field(s) ( in the portal )  have also been updated if they were empty to begin with.

           How can I fix my script  "all return"  so it only affects the Current Record -  Lines Work Order Portal fields ( return _date ) ?

            

      Here is my all returned script :

           Show Custom Dialog [ Title: "All Equipment Items Returned"; Message: "Do you wish to return remaining items today ? This will overwrite all existing Item Status Data. "; Buttons: “No”, “Yes” ]

           If [ Get ( LastMessageChoice ) = 2 ]

           Set Field [ ORDER::all_returned; "Yes" ]

           Set Field [ ORDER::all_returned_date; Get ( CurrentDate ) ]

           Go to Related Record [ From table: “ORDER”; Using layout: <Current Layout> ]

           Replace Field Contents [ LINES::return_date; Replace with calculation: If ( IsEmpty ( LINES::return_date ); Get ( CurrentDate );LINES::return_date ) ] [ No dialog ]

           Perform Script [ “update available stock test” ]

           Else If [ Get ( LastMessageChoice )=1 ]

           Replace Field Contents [ ORDER::all_returned; Replace with calculation: "No" ] [ No dialog ]

           Replace Field Contents [ ORDER::all_returned_date; Replace with calculation: "" ] [ No dialog ]

           End If

            

      Here is my update available stock test:

           Freeze Window

           Go to Layout [ “Inventory Details” (INVENTORY) ]

           Replace Field Contents [ INVENTORY::sum_product_portal_total; Replace with calculation: Sum ( LINES::items_out ) ] [ No dialog ]

           Replace Field Contents [ INVENTORY::available; Replace with calculation: INVENTORY::amount_in_stock - INVENTORY::sum_product_portal_total ] [ No dialog ]

           Go to Layout [ “Work Order” (ORDER) ]