Jump to content

When to Change Selected Layout during Scripting?


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

Recommended Posts

If I want to create a new record during a script, I need to select the layout that is associated with that desired table.. (Freeze Window..  create new record .. in the background) ..

But if I just want to set fields in a particular table (set field Table::Field), If I do not change the layout, will those changes always be on the same / last record accessed on the non-visible table?

Link to comment
Share on other sites

3 hours ago, Tony Diaz said:

But if I just want to set fields in a particular table (set field Table::Field), If I do not change the layout, will those changes always be on the same / last record accessed on the non-visible table?

No. The changes will be executed on the first related record (in the sort order of the relationship). This is assuming there is a relationship between the two tables - otherwise you will get an error.

In general, ANY reference to a field in a related table resolves to the first related record, unless you are in a portal. Or using it in an aggregate function.

 

Edited by comment
Link to comment
Share on other sites

A method to create record in another table:

Create a Global Field in your table -

Create a relationship between main table and target child table from the global text field to the UID in the other table turn on create related records check box

UID_TEMP  ----- UID 

In your script you would set the UID_TEMP to Get(UUID) and then you can set any field you want in the other table with new data it will create a new record - just remember to also set the foreign key in that table with the primary key from the table you are on.

Once you are done setting fields you can remove the value in the UID_TEMP

 

Notes.fmp12

  • Like 1
Link to comment
Share on other sites

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