nation Posted September 27, 2002 Share Posted September 27, 2002 can anyone help me figure out the script necessary to paste information from one data base into another using repeating fields? I've got two files: a product list file with an "item number" field and an invoice file with a repeating "item number" field. i would like to scroll through my products hit an item number field and have it paste automatically into the first empty "item number" repeating field on my invoice file. by making the product list "item number" a button which copies the number in the field, i can paste successfully into the first repeating field no problem. I'm using the If(Is Empty) ....Else ..Paste...to get to the second repeating field, which when I paste the first number copies into the second repeating field automatically - but then is replaced if I go back to the product list and hit another "item number" button. HELP!!! Link to comment Share on other sites More sharing options...
Anatoli Posted September 28, 2002 Share Posted September 28, 2002 Do not use repeating fields. They have very limited usage. Use Relation model instead Link to comment Share on other sites More sharing options...
Johnny Boy Posted September 28, 2002 Share Posted September 28, 2002 I second the opinion on repeating fields. It may seem like the best way now but in the future when reporting on product movement etc. you will be very disappointed with your limited options. John Link to comment Share on other sites More sharing options...
Doug Posted September 30, 2002 Share Posted September 30, 2002 I agree that you should avoid repeating fields, however, below I have outlined a script which shows how to put data into an empty repeating field. This represents only one method, and will need to be tailored to your situation. My sample involves a repeating field [test], a counter field [counter] to track which repetition of the repeating field you are on, a calculation field [RepCount] which has the count of repetitions shown on the layout for the repeating field, and a global field [g_data] to hold the data I want to put in the empty field. --- RepCount[number] = LeftWords(FieldRepetitions( "repeating.fp5" , "All Fields" , "test" ), 1) --- --- Note: you must display all the repetitions on the layout for this field to function properly. --- Script: Set Field [ "counter", "1"] Copy [select, "g_data"] Go to Field ["test"] Loop If ["IsEmpty(GetRepetition(test,counter))"] Paste [select] Halt Script Else Set Field ["counter", "counter +1"] Go to Next Field Exit Loop If ["counter=RepCount +1"] End If End Loop Show Message [ "No Empty Repeating Fields Available"] Link to comment Share on other sites More sharing options...
Recommended Posts