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.

Scrpit steps and field verification

Featured Replies

Hello,

I´ve written a script which creates a new record by copying given fields from a specific record to DIFFERENT fields in the new record. The way I have it set up, the record which originates the information for the new record is referenced with a globalID field which is copied from the RecordID.

The script works fine but goes back and forth between the two records a number of times in order to copy all the necessary fields.

The problem with this is that I had certain fields which were configured as "Not Empty" and validated. Needless to say I have to turn of field validation for the script to work, because certain fields aren´t yet filled in while the script moves between records.

Is there any way to copy several fields from one record and paste them into DIFFERENT fields of a new record in one step?

Is there any way to disable field validation while the script runs?

Also, if a date field is set to "Not Emtpy", is there any way of searching for records with empty fields? I turned on validation because many records were being left with empty fields.

Thanks.

Cheers,

Alvise

i suggest you use a SINGLE GLOBAL [ or pass a script parameter ] to hold the information from ALL of the fields of your original record. using a global means you don't need additional relationships. and a single variable means you don't have to go back and forth between the two records.

this is a common filemaker technique. all you need to do is create a calculation to put each field into the global filed with a return character "¶" between each field. [ don't forget to add one final return character at the end of the final string as well ]. this technique provides a long 'list' of information with one entry for each field, like paragraphs in regular text. you can access any item on this list in any order with the function MiddleValues ( text ; startingValue ; numberOfValues ) which is new in FMP 7. for instance, the syntax for accessing the third item in the list is MiddleValues ( gMyGlobal ; 3 ; 1 ).

hope this puts you on the right track

trev

  • Author

Thanks for your reply! Now why didn´t I post questions here BEFORE...?

Anyway, it works very well, except that the carriage returns are also copied to the field entries. How should they be inserted in the script?

The steps I have to copy field data into the global are:

Copy [select; field]

Paste [select; field]

Insert Text [field; " " ] - I´m inserting a carriage return here

then to paste in new record:

Set Field [field; MiddleValues ( field ; 1 ; 1 ) ], etc

Thanks again for your help,

Alvise

Hi bibi

to excude those carriage returns, use this calc:

Substitute(field; MiddleValues ( field ; 1 ; 1 );"¶";"")

  • Author

Mille grazie Daniele!

Alvise

Scusatemi l´Italiano

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.