I thought Get( LayoutNumber) would always return the same number,
but in Pro I'm seeing a layout as 15, but on WebDirect I'm seeing it 4.
Is there a way to get a consistent layout number?
I believe Get ( layoutNumber ) returns the number of the layout (counting down from the top) of all the layouts the user has privilege access to.
There is a way of identifying a layout with ID number using the functions LayoutIDs and Get ( layoutNumber). But what are you trying to accomplish here? What do you want your users to experience?
use a custom function that finds ListPosition for an item
the number you get back is the position the layout number is in the list returned by layoutIDS
so in the case of the list being
get layoutnumber returns 4, which is the 4th item in the list, so the layout is number 12
you can then go to layout by number and use the number 12 and you will get to the right place.
OR you can do the same thing with LayoutNames, then go to layout name by calculation
Thank you, David and jrenfrew.
After all these years I never knew Get ( layoutNumber ) worked like that.
I'll have to write my own custom function.
There ought to have been a function called Get (LayoutID).
I wanted to use permanent layout IDs instead of names because I don't want scripts to break if someone changes the names of the layouts.
I never did catch what you were trying to do.
For navigation I use get(layoutname). In scripts I put that into a variable, change to another layout do some work then use goto layoutname by calculation and give it the variable as the value.
Sent from my mobile device... Please excuse typos.
Further to the above, LayoutNumber is by no means persistent. It is, as David points out, just the position in the list of layouts the user can access, so:
1. If you move a layout in the layout order it changes number
2. The same layout may have a different number for different users, depending on their access privileges
3. If you use Go to Layout by name in a script and select the layout from a list (Specify…) and the layout name is subsequently changed, the script will register the new name and will still work. This will still work even if the layout's position in the list changes.
4. On the other hand, if in your script you choose Specify: Layout Name by calculation… the script will break if the layout name is changed, because you have, in effect, hard-coded a name which now no longer exists.
Therefore, for navigation your best option is to navigate by LayoutName, provided you also use the list selection in your script.
Retrieving data ...