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.

Editing table records through scripts.

Featured Replies

  • Newbies

I have just recently started using FM. My background is MySQL and Perl, needless to say I am used to alot of freedom and SQL.

Currently I am working on a database for a local swimming club. I would like to edit a tables records while I am in the layout for a different table or am I dreaming?

You can do this using scripts.

If its a related record - then 'go to related record' script step and use 'set field'.

Or just 'go to layout', find the relevant record and use 'set field'

Hello Arilian,

If the record you want to edit is related (via an n:1 relationship) to the current record of the current file, you can edit it via the relationship from where you are - including from within a script.

If the relationship is n:1, then the fields from the related table can be placed directly on the layout and can be viewed and edited in the same way as fields in the current table. If the relationship is 1:n or n:n, you will have to display related records in a portal (in order to view and access all n of them) and you will be able to edit records in their respective portal rows.

Otherwise, assuming you know what record it is that you want to edit (ie can identify it explicity by a unique value - eg primary key), you can use a utility relationship to the remote table to write to the record in question. Such a relationship would generally be set up from a global field in the current table to the primary key in the remote table. You would then write to the relevant record in the remote table by first setting the key value into the global and then setting the desired value into the related table via the utility relationship. This can be done manually or by script (or button command). By script it would look something like this:

Set Field [CurrentTable::gGlobalKey; 100285]

Set Field [utilityRelationship::YourTargetField; SomeNewValue]

...where 100385 is the primary key value of the record in which you want to edit the YourTargetField field to SomeNewValue. wink.gif

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.