Jump to content

Layout Database

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

Recommended Posts

I am trying to dynamically go to a layout depending on the value of a global field, but I am limited to jumping only to a layout number, rather than a name.

I have a clumsy solution, which involves generating keys in a layouts database, but was wondering if anyone had anything more elegant. Part of this is a simple script that loops through the layouts using Status(LayoutCount) Status(LayoutNumber) and Status(LayoutName).

I think what I'd really like is to be able to set several Global repeating fields, use the script to do a sort of PutRepetition of the LayoutName in one field, and LayoutNumber in another; then whenever I need the layout number, I can just loop through the repetitions until I find what I want, set a global field to that number, then do the goto.

Make sense, or am I beating around a very large shrubby thing?

Link to comment
Share on other sites

I've done it the same way, by looping through the layouts by number and testing the layout name. You'll find you can't loop through repetitions as the Get Repetition() function won't take a variable for repetition number. You can use the approach, but no loop, you must test each repeat explicitly. The advantage to testing layout names is that if someone changes the order, it won't mess up the operation (but a layout name change will). -bd

Link to comment
Share on other sites

Hi Tim

If you have "hundreds" of layouts, looping through will become slow. You could create a extra file with two fields: lay_name and lay_ID. In your main db, create a variable text field, say temp_lay_name. Make a relation with temp_lay_name to lay_name.

Now, you can set the temp_lay_name to the name of the layout you are needing, then you can jump to the layout number you will get on the related field lay_ID.

Sure, you have to create records of every layout you have, but there, you can use the looping with status(layoutname), as you have only to do this, when you are changing a layoutname or layout order..


Link to comment
Share on other sites

Now I could be totally misunderstanding what you want to do, but here's a suggestion:

Rename your layouts adding a number to their name e.g. layouts called Sales, Managers, Customers, become Sales LO1, Managers LO2, Customers LO3. Then use a script something like this:

If(TextToNum (Status(CurrentLayoutName))= 1)

Go to Layout (Sales 01)

End If

If you have lots of layouts, you'll of course end up with lots of of "Ifs", but I find this kind of script performs more quickly than a loop structure. Also, as long as you keep a number in there, you can change the layout name or its postion in the layout order without any problems.

Link to comment
Share on other sites

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