If you have a good qualifier in your products data that can help you decide to show layout 1 or layout 2 then you could use an OnRecordLoad event trigger to go to the proper layout based on that qualifier.
Could you give me a hand with the script part?
I'm just starting using filemaker and i'm not so good with the scripting part.
1 of 1 people found this helpful
You may need to provide more information. A "generic" script may not fit with your database and needs.
For writing scripts, I typically advise to manually think through all the steps you need.
Go to Layout
If you can manually think through the steps, it can be scripted!
There will be "qualifiers", but we don't know enough to help the best.
Also, it may help to study the FileMaker Training Series or any of the tutorials (here).
Let me have a look if i can get it working.
Thanks for the advice.
Thanks - will check out the training series
Not from the info provided. "it doesn't work" doesn't give us much to go on.
I will note that your script is only checking the value of TypeID for which ever record is the current record so you need to consider:
Is the correct record current?
Does that record specify the correct type Id?
Is the script actually being performed?
And if you have set up an script triggers on these layouts, you have to consider whether your script is triggering a script trigger that then runs yet another script that then interferes with the results that you expect here.
Can't i upload my file here?
But my problem is the next.
I've got 8 different Lay-outs.
The TypeID number is the number you see at the Type field.
But as you can see on the right side is that for each Lay-out i got a different condition check list.
It can happen that i got like 30 items from 8 Lay-outs which i want in one file.
So if i want to recall 1 item i need the good Lay-out.
The only reference i've got is the TypeID field all the others will change all the time.
But what i did in my script is that good?
Start with IF and then Else If and Else if etc.
Cause if that's good my problem (that it only works till nr 3) will be somewhere else.
If you used the advanced editor, see link in upper right corner of your reply box, you can upload a copy of your file as a reply to this thread.
I would not set up my solution like you have, but your script seems correct. That then leads to my questions about data, current record and whether your script is being performed when you think it is being performed.
For example, if you run the script and the layout correctly changes, but then you change to a different record, you may now be on the wrong layout for the current record until you run that script again.
What I would do is make that check list a set of related records where both the label and the response are a pair of fields in that related table. Each type of product could then use the same layout, but with a portal that lists the check list questions that are specific to each product type.
Ok here is my file.
I do not really understand what you mean with the Lay-out.
Cause I made it this way cause i couldn't get it working an other way.
What you are saying is that when i select for example a Helmet in the Type field.
Then on the right side the checklist options can appear or disappear?
PPE Master V5.fmp12.zip 399.3 K
The original problem is that the field on your layout and the field in your script are not the same field.
The field on your layout is "Objects::CountryID". The field in your scripts: "Countries::TypeID".
What I am suggesting is that you set up one layout where the right hand set of fields automatically changes to a list of related records in a portal where the items listed are determined by the object type. This gives you one layout to create and maintain instead of multiple layouts.
I suggest that you set up some related tables and a portal to make this happen.
Ok let's try to do that.
Thanks for your quick response.
I've got it working.
Still with my own design.
I've changed the script from TypeID to CountryID.
And it works fine now.
Thanks to all of you for the support.
It looks like the only difference is the area on the right.
You might consider making a tab (or slider) area and use one for each of the IDs. This would create 8 or more tabs. Name each tab object accordingly "ID01" etc.
Now when you open a layout you can have a trigger or step in the script determind the id and go to that tab object.
Thus you would only need one layout with a tab object with 8+ named tabs.
Each tab layout would contain the appropriate fields from your existing layouts.
Does this make sense to you or do you need an example.