archives8 Posted February 18, 2004 Posted February 18, 2004 Hi, I'm developing a new database at my job, and I'm new to how the filemaker scriptmaker works. I would like to have a script that checks the contents of a field and brings up the view that relates to that field. I'm dealing with a database that records technical information about many different types of recorded mediums. I need to be able to display the physical characteristics of each medium, based on the code for that medium. So if in the medium for a filemaker record is "cassette" I would like the database to display the casette characteristics view when the user hits a characteristics view button. basically: on button if medium == cassette go to cassette view elseif [next medium].... except that i have many types of mediums. I've been working with the manual but with little luck getting the scriptmaker to work. any hints or tips out there. thanks, -Don
Jarvis Posted February 18, 2004 Posted February 18, 2004 Here is one way to do this with an IF statement. You will need to have your alternative layouts already produced so that you can allude to them in the script dialog editor. When you open the Scriptmaker Dialog Box, click on the IF statement This will take you to a second screen where you want to select the field that holds the value you want to refer to. Fill in the rest of the script as follows: IF(Field A)= X GOTOLAYOUT (Layout X) ELSE IF(Field A) = Y GOTOLAYOUT (LayoutY) There are probably easier ways to do it, but this will get you started. PS: this is my first help hint. Thank you.
archives8 Posted February 18, 2004 Author Posted February 18, 2004 ok this is what the scriptmaker looks like right now, but when I click on the button i have setup for this action nothing happens. If ["Item_medium = "Analog cassette tape""] Go to Layout ["casette"] End If ---- am I missing something very obvious??
-Queue- Posted February 18, 2004 Posted February 18, 2004 Is there more in the field than just "Analog cassette tape"? PatternCount might work better for you. If [PatternCount( Lower(Item_medium), "analog cassette tape" )] Go to Layout [cassette] End If
John Caballero Posted February 18, 2004 Posted February 18, 2004 Hi Don, Here's a slightly more involved solution, but given that you have "many types of mediums", it might be better in the long run: Create an additional table (Layouts.fp5)that has two fields: Item_Medium & Layout_Name. My assumption is that for each type of medium, you want to have a seperate layout and that you've already created those layouts in your main table. For each type of media you deal with, you'll have a corresponding record in Layouts.fp5 along with the layout name that each medium should be associated with. Create a relationship from your main table to Layouts.fp5 that is linked by the Item_Medium fields in both tables. When you click on a button, the script looks through the relationship (and again, the relationship is based on the value in the Item_Medium field) to determine which layout to go to. Your script looks something like this: Go To Layout (relationship::Layout_Name) This gets away from having lots of If/Then/Else script steps and allows for things to be a bit more dynamic. If for some reason you need to change up layouts, you won't need to go digging through a bunch of If statements - you'll just change the assignment in your Layouts.fp5 table.
archives8 Posted February 18, 2004 Author Posted February 18, 2004 DOh! Ok figured out the problem. I had the buttons originally up in the header (made for clean navigation). Of course the script doesnt know what record to look at if the button isnt attached to the record. uggh. I guess you just have to learn some things the hard way. Thanks for the layout table tip. I'll try to integrate that tommorow, makes much more logical sense. -Don
Recommended Posts
This topic is 7587 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