Reviewing the GetLayoutObjectAttribute Function in FileMaker

Subscribe to Our Blog

This versatile function offers quite a bit of value to any developer’s toolkit. It gives us the ability to interrogate the state of different layout objects (also called introspection) which allows us to make our calculations and scripts smarter. Today we’re going to just focus on a one of the options, the attributeName parameter to take a look at some interesting behavior that could be leveraged as another tool in our developer toolbelt. 


objectName – in order to use this function, the object to be interrogated must have a name set in the position tab of the inspector. I prefer to use the naming convention of “” for clarity. 

attributeName – the name of a supported attribute specific to the type of the layout object. Which we are using the “content” for this example.

Persistent local variables

It’s possible to create local variables without running a script. Here you can see the layout we have some text describing the function:

Going into layout mode you can see that these are all merge variables placed on the layout, but they are all local variables which normally only exist as long as a script is executing

However, the only script in the file has no set variable steps

This is accomplished by utilizing the “Hide object when” calculation in the data tab of the inspector for layout objects in tandem with the content option for the attributeName parameter of the function.

Off to the side on this layout we have a text object with a calculation

This works because when FileMaker is loading a layout it has to check the hide object when calculation for each layout object to determine if it displays or not.  Here we’re using “Evaluate( GetLayoutObjectAttribute ( "text.display" ; "content" ) )”

Since we used a let statement to declare local variables as the content of our text object and wrapped it in an evaluate function FileMaker will instantiate the local variables even though no script has been run. Checking the data viewer’s watch tab, you can enter in one of the local variables and see that it contains a value but on the current tab the same variable will not be present.

Note that you can also set global variables using this same method.

These variables will persist until FileMaker is closed or explicitly removed through a set variable script step or through the watch tab in the dataviewer using something like Let() to set them to “”.


One use could be to dynamically alter the text sizes on a layout when the user alters the window size. Assuming we’re using the same technique here we can dynamically set the text size based on the size new window size. Since FileMaker redraws the layout on a window size change the hide object when calculation will be evaluated again and will update the sizes accordingly.

I’m excited to hear from you what you think you could do with this. Until then, happy FileMaking!

Download the Demo File