Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Refresh issue cause relatioship malfunction


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

Recommended Posts

Posted

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!

Posted

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.

Posted

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.

Posted

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]

Posted

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

This topic is 7746 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.