AnsweredAssumed Answered

replace field contents issue

Question asked by willrollo on May 29, 2015
Latest reply on Jun 1, 2015 by willrollo

Title

replace field contents issue

Post

I have this script (below) which is deisgned to replace a field's contents in all the records - the records are selected by a find script. I am pretty sure it used to work bit now the script onlt replaces the contents of the first record.. Any ideas? 

         
  • Set Error Capture [ On ]
  •      
  • Perform Find [ Specified Find Requests: Find Records; Criteria: PRODUCTS::Update: “"yes"” AND PRODUCTS::Type: “"AF"” ] [ Restore ]
  •      
  • If [ Get(LayoutName) ≠ "Products" ]
  •      
  • Show Custom Dialog [ Title: "Error"; Message: "You need to be on the Price list Page"; Default Button: “OK”, Commit: “Yes” ]
  •      
  • Exit Script [ ]
  •      
  • End If
  •      
  • If [ Get(FoundCount)=0 ]
  •      
  • Show Custom Dialog [ Title: "error"; Message: "Please tick some products to update"; Default Button: “OK”, Commit: “Yes” ]
  •      
  • If [ Get(LastMessageChoice) = 1 ]
  •      
  • Perform Find [ Specified Find Requests: Find Records; Criteria: PRODUCTS::Type: “"af"” ] [ Restore ]
  •      
  • Exit Script [ ]
  •      
  • End If
  •      
  • End If
  •      
  • Show Custom Dialog [ Title: "Update"; Message: "Would you like to update the price of the items that you have checked below?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
  •      
  • If [ Get(LastMessageChoice) = 1 ]
  •      
  • Export Records [ File Name: “file:../../Desktop/Prices Back Up.fmp12”; Character Set: “Unicode (UTF-16)”; Field Order: PRODUCTS::Category PRODUCTS::Creation_Account PRODUCTS::Creation_Timestamp PRODUCTS::Description PRODUCTS::Description_Toggle PRODUCTS::Description_Trade PRODUCTS::Discountable PRODUCTS::Hide PRODUCTS::ID_Item_pk PRODUCTS::Image PRODUCTS::Image_code PRODUCTS::Modification_Account PRODUCTS::Modification_Timestamp PRODUCTS::Nominal Ledger Code PRODUCTS::Price PRODUCTS::Price increase PRODUCTS::Update PRODUCTS::Updated PRODUCTS::Description Short PRODUCTS::FL c_InStock PRODUCTS::FL c_ToBeOrdered PRODUCTS::FL Description_Toggle PRODUCTS::FL Discount Code PRODUCTS::FL Image PRODUCTS::FL Net Retail Price PRODUCTS::FL Received PRODUCTS::FL ReorderAmount PRODUCTS::FL Retail Price PRODUCTS::FL Stock Remaining PRODUCTS::FL Trade Price PRODUCTS::Painted PRODUCTS::Type PRODUCTS::Wood ] [ No dialog; Format output using current layout ]
  •      
  • Show Custom Dialog [ Title: "Warning"; Message: "What percentage do you want to increase the prices by?"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No”; Input #1: PRODUCTS::Price increase, "Price Increase (%)" ]
  •      
  • Show Custom Dialog [ Title: "WARNING"; Message: "Are you sure you want to increase the price of the items below by " & PRODUCTS::Price increase & "%. ¶Remember to uncheck the boxes afterwards!"; Default Button: “Yes”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
  •      
  • If [ Get(LastMessageChoice)=2 ]
  •      
  • Exit Script [ ]
  •      
  • End If
  •      
  • Extend Found Set [ Specified Find Requests: Find Records; Criteria: PRODUCTS::Type: “"AF"” ] [ Restore ]
  •      
  • Replace Field Contents [ PRODUCTS::Price; Replace with calculation: (PRODUCTS::Price* PRODUCTS::Price increase/100) +PRODUCTS::Price ] [ No dialog ]
  •      
  • End If
  •      
  • Show Custom Dialog [ Title: "CHECK"; Message: "Check the new prices!"; Default Button: “OK”, Commit: “Yes” ]
  •      
  • Sort Records [ Keep records in sorted order; Specified Sort Order: PRODUCTS::Update; descending PRODUCTS::ID_Item_pk; ascending ] [ Restore; No dialog ]
  •      
  • Go to Record/Request/Page [ First ]

Outcomes