Jump to content
Salesforce and other SMB Solutions are coming soon. ×

repeating fields - scripting - yuk


nation
 Share

Recommended Posts

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

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

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

 Share



×
×
  • Create New...

Important Information

Terms of Use