Jump to content

IF's with more than 2 options

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

Recommended Posts


I have searched this entire forum and I can't seem to track down a solution to a problem I am having with the if structure in a script.

This is an example of what I am trying to accomplish:

One field is called Car::Name the other is called Car::Color, I want to create a report on what the user picks from a listbox. If the car doesn't match the color then I want an error message. I want to setup if and else if's scenerios in a script that I define for possible color matches to each car.

Example of both list boxes:













OK, let's say if the user picks Chevy I only want the options for them to be Blue, Black, Red.

If they pick Nissan I want the color to only be White and Orange.

And if they pick Ford the only color I want them to pick is Purple.

so if they pick another color that doesn't match, I want an error message to say "This car does not have this color"

I can't seem to create the if statements with something like: (the = should be not='s)

Set Error Capture [ON]

if CAR::Name="Chevy" and CAR::Color ="Blue" or "Black" or "Red"

Else IF CAR::Name="Nissan" and CAR::Color = "White" or "orange"

Else IF CAR::Name="Ford" and CAR::Color = "Purple"


Show Custom Dialog ["Message";"This car does not have this color"]

Go to Layout []

Exit Script

End if

How do I do a not= to more than one option in an if. I have played around with case, but I need to give it a default value at the end and I am not sure what that would be.

Thanks for the help

Link to comment
Share on other sites

I wouldn't do this with a script at all. Set up your value lists so that if the user picks chevy, the only options they can pick for color are Blue, Black, and Red.

Take a look at the Value List forum. There are all sorts of example of how to set this up. Basically you'll set up a value list which only contains related values. You create a self join so that the make of the car is related to itself. Then you can only pick colors that are available to each make of car.

HTH smile.gif


Link to comment
Share on other sites

Thanks Dan,

But do you have to set the value for the value list by matching value's from field? My database wll not have every possible color for each car in the database. This report is only going to show what is available but may not be in the database.

I have reviewed some, but they said you have to set the value list to match value from field and I can't do this for this report, so there must be another way.

Thanks again,

Link to comment
Share on other sites

Shadow, I will give this a try. The problem I am trying to avoid is having the user add other colors to the value list and then print a report with color options that I haven't specified. I want them to have flexability to add other values to the list, but this perticular report I want the options limited. I want this to be fool proof.

Link to comment
Share on other sites


I tried your code. If I leave it with not IsEmpty is will give me errors on the colors listed. If I remove the not it works. I then removed the )) at the end of the first line and added a ; and did the second line. I tested and now only the second line works and the first line doesn't. For some reason it is only taking the value from the second line. I then removed the second line and put in a ElseIF in my script and pasted the second line in there. Again the first value is ignored and it goes on to the second line.

There must be something missing from the equation.

Thanks for your help, I feel I am now getting so close. Also are there any good books on Filemaker that could give some great examples. The Filemaker help is OK, but it only has one or two different examples.

Link to comment
Share on other sites

I made a small 3 table file using a similar approach which Dan proposed. One table holds the car types, another holds the valid colors for each car, the third is the table in which the cars are entered w only valid colors showing in the list (field validation is also turned on). Hopefully this might give you some ideas.

Link to comment
Share on other sites


I would also go for the related fields approach. I have a similar setup for kitchens that have to comply with 7 parameters to end up with a price and partnumber (only a handfull of combinations are valid).

If you put these choices in your scripts, the customer will not be able to add/remove/edit the choices without going into your scripts (you don't want that) plus the script can become a real monster.

Making a seperate table and relation for each parameter will allow you to make a layout for your custom to edit all the possible combinations. It will also immediatly show only the valid choices and will not need to run a script later telling that this is not the correct color. In other words it is more user-friendly for your customer as well to only show the valid choices for the chosen car type.


Link to comment
Share on other sites

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