Jump to content

Numerical Value based on choice in a pull down menu


Wildy71

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

Recommended Posts

Hi,

I'm just starting with FMPro5, or any databases for that matter.

I am trying to make a DB that has a set of fields with a pull down menu that has choices of foods.

I also have a field that I would like to display certain numbers depending upon the choice in the pull down menu field.

I'm not sure how you would do this.

I figured out that if I make the second field a 'calculation' field, I can use an if statement something to the effect of, "if the food field is (lets say) eggs, then display (lets say) 3, if not, then display 0" My problem is, I have a long list of choices under the pull down menu of foods, and I want a variety of numbers to display, depending upon the choice.

Is that even remotely clear?

Thanks in advance if you are able to help.

Paul

Link to comment
Share on other sites

If you have a long list of items, you're probably better off using a related file (Foods.fp5) to store the values. An added bonus is that you can base your value list on the field in this related file. And, updates to the related file will automatically be reflected in your value list. The related file would have two fields, FoodName and Number. Create a record for each Food/Number combination. You would base your value list in the main file on the FoodName field in the related file. The displayed number would then just be the related Foods::Number field.

[ November 13, 2001: Message edited by: BobWeaver ]

Link to comment
Share on other sites

That is one way and you can use CASE, which will be shorter, those IFs.

Or you can write the number directly with text in valuelist and then just extract the number.

And even better will be to create the value list "on the fly" from field or even from another database.

Link to comment
Share on other sites

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