Fields or Variables with a Scope of 'Instance'

FM provides fields and variables with varying scopes:

  • table global fields ( all TOs of a table, same value )

  • table fields ( all TOs )

  • global variables ( file )

  • variables ( script )

  • values ( custom functions )

What is missing are table fields/variables with a scope of 'instance'. Instance is an open window with a TO tied to it.
I find this curious as FM does handle information with instance scope -> found set, sort, summary fields, layout objects with calculated values (i.e. tab control tab titles).

Haven't found a clean way to get around this, I'm curious how fellow developers handle instance-scoped data.

maybe @MonkeybreadSoftware has something or they can build something

You can use FM.VariableSet in MBS FileMaker Plugin for global variables per app instance.

And with Window.SetTag you can associate a value to a window, e.g. a plugin based dictionary.

1 Like

I'm confused by this.

Do you want to be able to store different data sets for different window sessions?

Did you know that you can use single $ variables in layout calculations and they are retained in the scope of the layout? I've used it for layout level display purposes but that is tied to the layout not to the window.

My use case is:
A given layout is instantiated in 1 or more windows, each window displaying different records of the TO.
Depending on a record's or field's status, different labels and value lists are required. This must happen on a per window (instance) basis. A variable-value across all windows of a layout won't do it.

That's what you'll get with local variables in the layout

DollarVariables.fmp12 (276 KB)

4 Likes

I removed my posting since a super nice person who frequents this forum suggested my posting was, in his opinion, off target and might annoy some folks which is never my intention. :slight_smile:

I admire your perseverance in making micro services palatable to the rest of us. I have not yet dared to do so myself, since I know almost nothing about JavaScript.

1 Like

That's awesome! I do use $vars in layouts, but I wasn't aware that they then actually work per layout in a window.

I use Java personally, but there are JavaScript frameworks too. And python. And .NET. And, ...

It’s easy to get started. Pick your platform first and then check out some free tutorials. The language you use shouldn’t matter.

:sunglasses:

That's great stuff, @Malcolm. Thanks!

3 Likes