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.

Refresh issue cause relatioship malfunction

Featured Replies

From a main file I'm creating a record (via script) in a related file and writing data on that record.

The script in the main file...

1) calls a script in the related one, that creates a new record, assign an unique ID and set the global gID to the value of the ID of the record just created. Then...

2) control goes back to the main script that copies the global in the related file in a global in the local file (trought a dummy relationship)

A relationship relates the global (containing the ID of the fresh record) to the IDs in the related file.

3) Trought this relationship the main script writes on the fields of the new record.

-------

Here is the problem:

unless i put a

EnterPreviewMode[]

EnterBrowseMode[]

between 2 and 3 the relationship doesn't work and data is not written on the new record.

It seem a refresh problem...

The script have to create a LOT of records and those two script steps slow down the procedure.

Any idea on how to work this around?

Any idea on how to create and write fast a lot of records in a related file (I can't use Import) ?

Thank you!

Paolo,

The record in related is not commited yet that you're switching back to the Main script.

So try an exit record step immediately after the Create NewRecord path in your external script (1).

It should work OK now.

  • Author

Thank you! It works!

But I think I'll use another (more common) tecnique to populate the related db.

I' make a global field for each field in the db.

Then the main script writes into the globals and call a script (in the related file) that copies the data from the globals to the standard fields.

This way is less elegant and I have a lot of fields, but it is faster because filemaker doesn't have to process the relationship for each record created.

Again, thank you Ugo!

Ciao.

Hmm....

It depends upon what exactly you're processing.

I generally use globals this way when there's some need for a validation before final input (check dupes, store some unindexable values,...)

If not, I'd use a global in main populated with the value of the new record, and would enter data in related fields using a relationship Main:GlobalID::Related:ID.

Perform External Script [New Record]

-----New Record

-----SetField[g_TempID, ID]

SeField[g_ID,Constant::g_TempID]

Go To Layout[Data Entry]

  • Author

I'll explain better my situation...

...but on a different post (ScriptMaker ???: Upload Download)

since the discussion is no more on a refresh problem.

If you have any idea to share, it will be very appreciated, as always!

Paolo

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.