AnsweredAssumed Answered

Automatically creating records after found set

Question asked by clomama :D on Feb 26, 2015
Latest reply on Mar 3, 2015 by clomama :D


Automatically creating records after found set


I've got 2 tables - 'Products' where all product names saved to this table & 'Prices' from which I want to extract product names to the 'Products' table if there are no record found.

Here are my scripts:

Allow User Abort [On]
Set Error Capture [Off]
Go to Layout ["Prices"]
Go to Record/Request/Page [First]
   Set Variable [$SupplierID;Value:Prices::SupplierID]
   Set Variable [$ProductName;Value:Prices::ProductName]
   Set Variable [$Barcode;Value:Prices::Barcode]
   Set Variable [$Price;Value:Prices::Price]
   Go to Layout ["Products"]
   Enter Find Mode []
   Set Field [Products::SupplierID]
   Set Field [Products::Barcode]
   Perform Find []
   If [Get(FoundCount)=0]
      New Record/Request
      Set Field [Products::SupplierID;$SupplierID]
      Set Field [Products::ProductName;$ProductName]
      Set Field [Products::Barcode;$Barcode]
      Commit Records/Requests
  End If
  Go to Record/Request/Page [Next; Exit after last]
End Loop

However, the cursor kept blinking & nothing happened for long time. I got no choice to press ESC key. Where did my script go wrong?

Thanks for the help!