GetLayoutID ( layout )
Gets the layout ID of current or named layout
Average rating: 4.1 (34 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Use: Gets the Layout-ID of current layout if parameter layout="current" or of the layout which name is in parameter layout
Problem: You use some kind of navigation that want to switch to another layout when a button is pressed, but you want to be able to change both layout names and layout order without the solution breaks.
Solution: Use the function GetLayoutID in combination with the function GetLayoutNumberFromID to be able to do navigation between layouts without your application breaks if layouts change names or order.
In other words: Where you save which layout name or layout number to go to, save the layout id instead and then look up which number the layout has at the moment with function GetLayoutNumberFromID ( layoutID ).
|Robert, Luxembourg Europe
Sep 30, 2010
Thanks for your function, but it is a little buggy.
Function will return the ID of the 1st value but should return the ID of the 3'd value.
replace: theLayoutNames = LayoutNames ( Get ( FileName ) );
with:theLayoutNames = "¶" & LayoutNames ( Get ( FileName ) ) & "¶";
replace:theLayout = If ( layout ="current" ; Get ( LayoutName ) ; layout );
with=theLayout = "¶" & If ( layout ="current" ; Get ( LayoutName ) ; layout ) & "¶";
replace:Position ( theLayoutNames ; theLayout ; 1 ; 1 ) ) ;
"¶" ) + 1 ;
with:Position ( theLayoutNames ; theLayout ; 1 ; 1 ) ) ;
"¶" ) ;
|Roman Hofstetter, Zurich
Aug 30, 2011
|This function doesn't work, if you have a Layout named "Example1 Overview" and a Layout named "Example1". If you search for "Example1", the script step Position() will now the position of "Example1 Overview" and you get the wrong ID.
Solution: Check if the Layoutname is on the beginning or the end. Otherways search for ¶Layoutname¶. Like that you're sure the whole name is identical.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.