Jump to content

Get All Layout Names in another file


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

Recommended Posts

I have created a script that gets the layout count and then loops through to get all the layout names. The script works fine except I need it to get the layouts from another window.

 

So, in the script I move to the window name in question and begin the loop but it gets the values from the original file not the currently active window. I guess this is the way it works, so is there any way around this? There is not relationship between the files nor do I necessarily want one but if it is the only option I guess I can go that way.

 

I know with databases like SeedCodes SQLExplorer it can be done and in this dbase you do actually add the remote dbase to the relationship graph, so that's why I believe that may be the key.

 

Any help is greatly appreciated.

 

Link to comment
Share on other sites

Did either of you even read my post?

 

I know how the design functions work. The problem is when I move to a new window and run for example Get(LayoutCount) I get the number of layouts in the original file not the number in the file of the active window.

Link to comment
Share on other sites

That's how scripts work.

They only work within their own file. 

You do not know the file name associated with the other window?

In the bigger picture: what is the purpose of this process?

Link to comment
Share on other sites

I suggest you keep your shirt on, so to speak. No one owes you anything, and It's not like your question is entirely clear, too. It would be helpful to see your script and - most importantly - to understand the purpose behind what you are trying to do.

 

In any case, this part:

 

So, in the script I move to the window name in question and begin the loop

 

 is not possible. A script in this file cannot do anything in a window of another file. So if you want to get the layout count or layout names from another file, you need to call a script in the other file, and get the result back from the called script. Of course, to run a script in another file, you need to add it as a data source first. And in order to do so, you need to know the file's name. And, if you know the other file's name, you can get the desired result directly by using the LayoutNames() function. So the answer given is not entirely without merit, I think.

Link to comment
Share on other sites

With all do respect I think the fact I wanted to get info from another file was very clear in my first post if you read it again, either way I digress. Here is what I am trying to do and I am a bit closer but it's not beginning to look possible.

 

I dug into how SQLExplorer works and it is using the ExecuteSQL function with the special Filemaker_Tables feature. This works well, but does not give layout info only the underlying Table names so this won't really work with what I am trying to do.

 

The purpose of this is for a code generator I am working on. I have a database that generates PHP_API code and it works great. I use a combination of Zurb Foundation, jQuery, and AJAX to create list and detail views of my database with one click. It creates field masking, validation, modals and everything automatically. Currently, the only problem is I have to manually enter layout and field names I want for each view. I wanted to enhance the system so that instead of entering the database, layout, and field name info manually for each page I could just "point" it at a database to collect all the layout and field information and generate the pages for an entire database in one shot.

 

Not a big deal for my purposes as I can just copy and paste the script into the database in question. I was just looking to make it a little more modular so I could eventually share this with other users. Anyway, it doesn't seem that without touching the "second" database this will be possible.

 

My other thought for users of advanced would be to pull the info from a DDR XML report and then generate all the code from there which is looking like a solid option other than the advanced requirement.

Link to comment
Share on other sites

I think the fact I wanted to get info from another file was very clear in my first post

 

I agree. And the LayoutNames() function can do this - provided the other file is open (which I believe is a given in your situation) and that you know (or can obtain at runtime) the name of the other file.

 

Note that this is true for practically all design functions, so once you know the file's name, you can get all its design info that way.

 

 

I wanted to enhance the system so that instead of entering the database, layout, and field name info manually for each page I could just "point" it at a database to collect all the layout and field information

 

Well, that's crucial point here: how exactly will you do this "pointing"? Perhaps you could use the DatabaseNames() function as your starting point.

Link to comment
Share on other sites

Yes, we read your post.

Your post is titled, "Get Layout Names in another file"

We replied by reminding you of a function that requires the file names of the other files.

It seems that since you are setting up something where you know and and are in control of the other files, this should not be a problem.

 

In addition, window names normally =  file name unless a script has changed the name of the window.

So: you have a native function - windowNames; which provides what you need.

EDIT: as well as the DatabaseNames function mentioned by Comment.

Link to comment
Share on other sites

Combining the info above:

The Windownames function returns window names in their "stacking order"

So if the user is in your utility file, and the "next" window is the window you want to collect layout names for, then you don't have to navigate to that window.

This gives you the layout names for window 2.

 

LayoutNames( getValue( WindowNames; 2))

 

You can easily build a selector that uses databaseNames or windowNames to allow the user to walk through the open files or select them or just have your script automatically process the list and update or skip if it already has data for files.

Link to comment
Share on other sites

Did either of you even read my post?

Of course they did! Why are you trying to antagonize them?

With all do respect I think the fact I wanted to get info from another file was very clear in my first post if you read it again, either way I digress. Here is what I am trying to do and I am a bit closer but it's not beginning to look possible.

Apparently your description wasn’t as clear as YOU thought it was. Please do not exhibit your frustration over your needs by making personal barbs on our members.

If you would have bothered to read some of the 23,000 plus posts by comment or the 3,200 plus posts by Bruce, you would see that these to gentlemen often are clairvoyant in being able to figure out what the members are asking, on the flimsiest of information given.

Anyway, play nice and you will receive their maximum assistance.

Lee

Link to comment
Share on other sites

Listen I didn't mean to antagonize anyone. The only reason I said that at all is the first two replies simply pointed me to the design functions!! They didn't address anything to do with the problem which was pretty clear as BruceR stated. The title of the post was 

 

 

Your post is titled, "Get Layout Names in another file"

We all come here for help and I do appreciate anyone willing to take the time to reply, however it doesn't help anyone to post info that doesn't even address the problem. I didn't call them names, or insult anyone in any way shape or form. I only wanted to point out the fact that I understood the design functions and that they overlooked my core problem. If there is any antagonizing going on it seems to be coming way after the fact.

 

Anyway, I have my answer, which is that it's not possible without a script in the second file etc. This is what I had suspected all along.

Link to comment
Share on other sites

The only reason I said that at all is the first two replies simply pointed me to the design functions!! They didn't address anything to do with the problem which was pretty clear as BruceR stated. The title of the post was 

We all come here for help and I do appreciate anyone willing to take the time to reply, however it doesn't help anyone to post info that doesn't even address the problem.

 

You were focusing on your method, while the answers you got were providing you with means to reach the (stated) goal. Also, you should at least consider the possibility that more experienced posters are able to see what the better approach to a given goal is, rather than assuming off-hand that they're wrong.

 

But even if you think a reply is beside the point, a response like “Did you even read my post?" is usually considered as rude (well, its sub-text is, at any rate …).

 

Anyway, I have my answer, which is that it's not possible without a script in the second file etc. This is what I had suspected all along.

 

If that is your conclusion, you should read more carefully.

 

By combining the design functions DatabaseNames and LayoutNames() (as was suggested by both comment and Bruce), you can compile a complete list of all layouts in all open database files from the context of one file – or e.g. create a selection list of databases to choose from, then create a list of file-specific layouts for the selection.

  • Like 1
Link to comment
Share on other sites

Simple answer - "See LayoutNames function"

 

I apologize to both comment and BruceR. You did see the issue for what it was. I got distracted and completely missed your reference to this function. I was simply stuck on the fact this would be a Get function.

Link to comment
Share on other sites

This topic is 2570 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.