Reusing a Dynamic External Data Source Variable

I thought I'd share a cool behavior of FileMaker External Data Source(EDS) variables. This came up in a slack group.

Say you have a scenario where you want to run a script by name in a bunch of fmp12 files in a row, but you don't want to define a dedicated external data source for each file (Maybe it's A LOT of external files, for example).

Instead, you can reuse the same EDS variable for each external script call, closing each external file as soon as you're done with it. Please note, this only works if your caller file does not have any Table Occurrences from the external files in the graph, because that will lock the external file open as soon as it is used.

I have a single external data source defined:
Screen Shot 2020-10-09 at 12.14.56 AM

And the script looks like this:
Screen Shot 2020-10-09 at 12.15.44 AM

If you want to work with multiple dynamic EDSs at once, you'd need multiple EDS definitions like DYNAMIC_EDS1 = $$DYNAMIC_EDS1, DYNAMIC_EDS2 = $$DYNAMIC_EDS2 etc... because while an EDS is in use, it cannot be used to open another file.

There are other uses for this technique. For example, we have an updater file that we use for complex data migrations and the necessary external data sources are unpredictable. We have buttons on each row to open and close those external files, and we keep track of which files are open in global variables:

Another thing to remember is that File Access Authorization rules still apply here. A file can only call a script in another file if that other file has granted access to the first file in Manage Security > Advanced Settings... > File Access.

I forgot to provide an example! Here: Dropbox - Dynamic EDS - Simplify your life

5 Likes

Whoops, forgot to link the example file. Added to post body.