Jump to content

Trouble Getting Layout Number


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

Recommended Posts

Hi,

 

I change my layout number to a name as soon as the layout is created.  And I've been stuck navigation to my layouts via the name not the number and here is why.  Any help here i would be grateful.

 

Thinking I could just use the "Get ( LayoutNumber )" function.  But to my surprise, nope!  I get the layout number based on the layout order in the layout pull done menu, hmm...

 

1 Home

2 Navigation

3 Preferences

4 Portal

5 ... ect.

 

So if I'm on my Portal layout, "Get ( LayoutNumber )" gets ... 4 Not ... 23

 

Which is what I'm looking for 23.  

 

Yet LayoutID ( FileName ) produces a list of all my layouts by ID.

 

So where is the Get ( LayoutID ) ???  I need this number to navigate to the layout I want.

 

Any suggestions 

 

Thank you.

 

Tom :-)

 

 

Link to comment
Share on other sites

Why are you using either of these functions?

 

The standard FileMaker go to layout command handles layout renaming and layout re-ordering reliably and automatically.

Link to comment
Share on other sites

Hi Bruce,

 

My understanding I read somewhere that ... Best Practice is to use the Layout_ID not the Layout Name due to Layout Name changes especially if you have to write into your calculation the layout name and I'm forced to do this a lot ( if you have a better way please advise ) ...

 

If ( Get ( LayoutName ) = "ABC" ; Do This ; If ( Get ( LayoutName ) = "DEF" ; Do This ; If ( Get ( LayoutName ) = "GHI" ; Do This ; "" ) ) )

 

Get ( LayoutNumber ) is just a bad due to layout reorder :-(

 

Anyway, any guidance here I would be grateful.

 

Thank you Bruce.

 

Tom :-)

Link to comment
Share on other sites

IMHO, the best practice is not to get into a situation where your calculation depends on the layout name (or ID). If this is truly unavoidable, you will need to find the index number of the current layout's name in LayoutNames() and use it to retrieve the corresponding value in LayoutIDs() - see:

http://www.briandunning.com/cf/908

 

Note that Filemaker allows you to have more than one layout with the same name - and if you do, there will be no way to tell them apart by name alone.

 

Another thing to note is that layout IDs are file-dependent. If you migrate your solution to a newer file, the layouts can easily be assigned different IDs and all your calculations with hard-coded IDs will need to be rewritten.  Just one more reason not to go that way.

Link to comment
Share on other sites

Bruce didn't say to use the layout name. I think he assumed you were trying to navigate to a layout in a script.

 

Personally, for situations like I think you're describing, I use a text box on a layout with a name and a value. The calculation would reference this text box's name using the GetLayoutObjectAttribute() to get the value.

Link to comment
Share on other sites

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