Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5955 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted (edited)

I have a (hopefully) simple problem in this example script, in which I want to copy 3 fields from 1 record in table1, to create 3 new records in table 2.:


Set Variable [$counter; value:1]

Go to Layout ["table1" (table1)]

Go to Field [table1::tab1field1]

Loop

Set Variable [$currentfielddata; value:Get (ActiveFieldContents)]

Go to Layout ["table2" (table2)]

New Record/Request

Set Field [table2::tab2field1; $currentfielddata]

Go to Layout ["table1" (table1)]



/*Now FM has forgotten that I had selected tab1field1, 

so the next command goes wrong.



In my mind it should have gone to the 

second field that I wanted to copy.*/



Go to Next Field



/*Now tab1field 1 is selected instead of tab1field2*/



Set Variable [$counter; value:$counter + 1]

Exit Loop If [$counter > 3]

/*leading to 3 new records in table2 with only data from tab1field1*/

End Loop

Is it possible to return directly to the field in the layout from which I came so that I can step to the correct next field, or is it simpler to just make an array of the data of the 3 fields in table1, go to table2 and process the array into 3 separate records?

Thank you very much in advance for your help!

Best wishes, Marc

Edited by Guest
Posted

... or is it simpler to just make an array of the data of the 3 fields in table1, go to table2 and process the array into 3 separate records?

That is the way to go.

Something along this way:

Go to Layout ["table1" (table1)]

Set Variable [$MyFieldsdata ; table1::tab1field1 & ¶ & table1::tab1field2 & ¶ & table1::tab1field3]

Go to Layout ["table2" (table2)]

Loop

Exit Loop If [ IsEmpty ( $MyFieldsdata ) ]

New Record/Request

Set Field [table2::tab2field1; GetValue ( $MyFieldsdata ; 1 )]

Set Variable [$MyFieldsdata ; RightValues ( $MyFieldsdata ; 2 ) ]

End Loop

  • Newbies
Posted

That is the way to go.

Thank you Daniele, also for your example! This should definitely get me on the right track!

Cheers, Marc

This topic is 5955 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.