Jump to content

[Samples] Context Free Record Creation


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

Recommended Posts

File Name: Context Free Record Creation

File Submitter: Ocean West

File Submitted: 30 Dec 2011

File Category: Samples

FM Version: 11

FileMaker requires you to be on a layout or use the relationship to establish context in order to create a record in a given table.

You could us a plugin that uses SQL to create a record in a table or you can use this technique.

It's very simple.

From the Source table you export field context the primary ID field to a text file. I choose to export it to the temporary directory path.

Then you immediately import that same file in to the target table --- That is right you do not need to be on a layout that tied to the base table occurrence -- you could be on any unrelated table.

On import you adjust the field map to import the value of the text file into the foreign key field of the target table.

In this example it is a different take on a Note Log. You can type into a global field and on exit it will trigger the script to export and import that one record then clears the global field. Data entry options in the note field in the target table is defined to use the value stored in the global field.

you could choose to do things more elaborate like either exporting more columns of data by building a tab separated values to a global field and export that and import it into any table matching field names (provided your first row includes field names - and you omit them on data entry )

OR you can set variables to the desired values and then on the target table set the data entry options to the corresponding variables.

And if you choose to include data other then the ID fields you may wish to also delete the file you can do this by un checking the Specify Field checkbox on the Export Field Contents script step.

=================

Now with all this established I realized that this technique will not work on FMGo because the exporting of the file.

So there is also another script layout and table that will in essence do the same thing and it only needs to IMPORT one

record from a temp table and doesn't need to export. I actually like this method better; but kept both concepts in the

sample file for you to explore.

Cheers

Stephen

Click here to download this file

Link to comment
Share on other sites

  • 11 months later...

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