Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

loosing selected field switching from layout to layout

Featured Replies

  • Newbies

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

... 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

  • Author
  • Newbies

That is the way to go.

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

Cheers, Marc

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.