Newbies vet2vet Posted March 13, 2009 Newbies Posted March 13, 2009 I hope I am in the right section for this question. I have only done very basic databases with FileMaker as of now, and basically no scripting. I am sure this is a ridiculously easy question for most of you. I have a drop-down list with several values. What I want to do is when a certain value is selected, change to a layout associated with that value. I think I know the basic idea of how to do this, but not exactly. I'm thinking it would look something like: If "field name" = "specific value" then go to "specefic layout" This is only for one of the values, the rest would stay on the current layout. Essentialy what i am doing is, if Widow is selected then add fields for widows name. The only way i know to do it is go to a new layout with those fields added. So if there is a better way of doing it let me know. Seems simple, but i'm not sure how to implement it. I apologize for such a newb question, but I do have a book coming so this should be the last. Thanks for any help.
aldipalo Posted March 13, 2009 Posted March 13, 2009 (edited) Welcome to the forum. We're all very happy to help. You may want to consider some tabs on your layout rather than create an entirely new layout. Basically, you are correct your script would look something like: If(ValuelistField = "Widow") Go to Layout(Widows Layout) EndIf If you saw a need to use this script to go to other layouts from this field you could use a 'Variable' Set Variable($Trigger;ValueListField) If($Trigger = "Widow") Go To Layout(Widows Layout) EndIf If($Trigger = "Bachelor") Go To Layout(Bachelors Layout) EndIf // you can repeat this as many times as needed In version 10 you would right click on the valuelistfield and click on "Set Script Triggers" then choose how you would like the script to be activated. Probably on modification, but, that's a personal choice. Please don't hesitate to come back and ask more questions. That's how most of us got started. hth Edited March 13, 2009 by Guest
krmullins Posted March 13, 2009 Posted March 13, 2009 Welcome to the forum. We're all very happy to help. You may want to consider some tabs on your layout rather than create an entirely new layout. Basically, you are correct your script would look something like: In version 10 you would right click on the valuelistfield and click on "Set Script Triggers" then choose how you would like the script to be activated. Probably on modification, but, that's a personal choice. Please don't hesitate to come back and ask more questions. That's how most of us got started. hth aldipalo brings up one of the really nice things about version 10, script triggers. It is nice to have that functionality built in. I think the tab option is a good choice if you have a couple of fields that are different. Another option would be using conditional formatting if it is just adding some additional fields to the layout. So if you pick Window in your drop down then you could show some additional fields that allow you to record the size of the window. With conditional formatting you could color the text and boxes the same color as your background but if that option was selected in the drop down your conditional formatting could change the colors to something visible. Using tabs might be a better solution depending on what you actually need to accomplish, but conditional formatting is an interesting option.
Newbies vet2vet Posted March 13, 2009 Author Newbies Posted March 13, 2009 Thank you so much for the quick responses and very good tips. I am limited to what I can do with FM 10 because my databases are being shared with users running FM 7. : Not sure how well tabs will work. The problem I am having now is that when browsing records the script is not ran to change layouts depending on the value of the field. Any ideas on how to fix that? The conditional formating idea sounds like it would work. Thanks again for the help.
krmullins Posted March 13, 2009 Posted March 13, 2009 The FM7 thing will get you. Tabs and conditional formatting and Script triggers are post 7 features so you can't use any of them to meet your needs. If you need to make your solution 7 compatible, then you might have to use a third party plugin like DoScript http://myfmbutler.com/index.lasso?p=416. In 7 there is no way to perform an action when you select a drop down from a list without using a script trigger plug in. In FM10 the functionality of using Script Triggers on the field would only work when you select the drop down. Changing records wouldn't activate the script that is assigned to the drop down. You could however also put a script that would evaluate the value in that field and change to the tab you want on a OnRecordLoad Layout Script Trigger, but that wouldn't work for your 7 clients. The 7 clients actually make this a much harder question to answer. I will have to think about it a little more. Or hope for some others to chime in. Can you describe what your trying to accomplish in a little more detail? Kevin
aldipalo Posted March 13, 2009 Posted March 13, 2009 (edited) Here's a file showing you how to do all 3 methods. hth **************************** I saw the 7 problem after I created this for you. You can use DoScript EventScript Scriptfire to do the script trigger. It's a little more complicated. Prior to FM10 I used scsriptfire. Tabs and naming objects as well as script variables (I believe) all became available after FM7. There were many workarounds for tabbing and you should be able to find some threads here on the forum. How many copies of FM 7 are you talking about. Perhaps, if management really wants these features, you should consider upgrading. You will also find a number of examples on Ray Cologans site: http://www.nightwing.com.au/FileMaker/demos.html#fmp7 Filemaker Magazine: http://www.filemakermagazine.com/videos/15-minute-tabs-the-quickest-way-to-make-a-tabbed-interface.html hth Dissappearing_Field.zip Edited March 13, 2009 by Guest
Newbies vet2vet Posted March 13, 2009 Author Newbies Posted March 13, 2009 Thanks for all the help, you guys are great : I think we are going to have to just break down and upgrade everyone to 10. I was not aware of just how much better it was. I think with all the new features I will redesign the database with tabs. The OnRecordLoad Layout Script Trigger should solve my problems.Thanks again for everyones help.
Recommended Posts
This topic is 5734 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 accountSign in
Already have an account? Sign in here.
Sign In Now