1 Reply Latest reply on Feb 4, 2013 12:19 PM by philmodjunk

    Scripting hang-up



      Scripting hang-up


           'Purchase Records'  contains two fields:  'item description' and 'price paid'. My script should transfer both these entries into a new record in corresponding fields in teh table 'Inventory'.  However, only 'item description' transfers - I cannot get the price paid to display, even if I write a separate script. So far I have:

           Copy (select:purchase records::item description)

           Go to Layout ( "Inventory" (Inventory))

           New Record request

           Paste[No Style;Inventory::Item)


           So far so good. How to get price paid transferred as well?



        • 1. Re: Scripting hang-up

               First, using copy/paste in scripts is not the best way to move data from one table to another. Both steps will fail to work without displaying any error message to tell you that they didn't work if the fields being copied from or pasted to are not physically present on the layout. A more serious issue is that copy replaces any data the user may have previously copied to the clipboard with the data the script is copying. Having data mysteriously disappear from the clipboard tends to annoy and confuse the user and is something easily avoided by using different script steps that do not affect the clipboard.

               Set Variable [$Desc ; value: purchase records::item description ]
               Set Variable [$price ; value: purchase records::price ]
               Go To Layout ["Inventory" (Inventory)]
               New Record/Request
               Set Field [Inventory::Item ; $Desc ]
               Set Field [Inventory::Price ; $Price ]

               This example does what you describe, but I suspect that such is not truly necessary as normally a relationship linking your two tables by an Id number makes such wholesale copying of data from multiple fields unnecessary.