Page 1 of 1

Recursive Scripts

PostPosted: Tue Jun 29, 2004 2:29 pm
by jeemart
I am designing an Auto Database. I need to know how to add say "FORD" into the first field then the second field automaticlly lets me choose the "MODEL" of the car say "FOCUS" "KIA" as an example. Another example would be "PORSCHE" second field "CARRERRA", "BOXSTER", etc
Thank in advance. Martin

PostPosted: Tue Jun 29, 2004 5:39 pm
by John Sindelar
Hi Martin,

You don't necessarily need a script for this as you just want the values presented in the second field to be "conditional" on the values in the first field. Search FileMaker Pro 7's online help for the phrase "value list". The first entry is a two page article that goes into this; you're looking for the first bullet point presented:

From a field in the current file or another file. This method provides flexibility because the value list can dynamically update itself based on the current values in a field. If the field is in a related table, you have the option of showing all the values in the field, or only the related values.

In your case you'd be interested in the "related values", specifically all the models (Focus, F-150, etc.) related to the manufacturer (Ford). The details of how to do this are interspersed over the two page article and will require you to set up two tables, one of manufacturers and one of models, with a relationship between them.

PostPosted: Wed Jun 30, 2004 8:29 am
by jeemart
Hello John
Thank you for the reply. Forgive me but I am new to Filemaker and am still a little bit confused. The bit what I am having difficulty with is the relationship.

I want in the manufacturer field to have a drop down menu for eg Audi, Ford, etc. So I choose Ford. Then the second field updates to only show Focus, Kia, etc then I select what I want. I created 2 new fields (manufactuer and Model). I have done this so far and need help after this.

Thanks again for your patience.

Martin

Conditional Value Lists

PostPosted: Wed Jun 30, 2004 10:33 am
by John Sindelar
Hi Martin,

This stuff can be so hard to write about, don't you think? =)

I've posted a little FileMaker 7 sample file that does what you're interested in. Check out the define relationships graph and see how we have separate tables for Manufacturers and Models. The data entry is done in a third table (called Example) where the value list for manufacturers pulls every value from the manufacturer table.

The value list for models, however, only pulls related values though a relationship from Example to models *through manufacturers*.

Hope the helps: Sample.fp7

John

Recursive Scripts

PostPosted: Wed Jun 30, 2004 11:53 am
by Guest
Thanks that works great. Just one last thing where is the data A4, A8, F-150 stored as I cannot find that.

Sorry to trouble you again.

Martin

PostPosted: Wed Jun 30, 2004 12:20 pm
by John Sindelar
No trouble. The data you're looking for is in the Models table. Check out the tables tab of the define database dialog to see a list of all the tables you're dealing with.

Enjoy!

Still looking

PostPosted: Wed Jun 30, 2004 1:51 pm
by Guest
Call me stupid but I cannot still find the list like A4 A8,etc

PostPosted: Wed Jun 30, 2004 2:31 pm
by John Sindelar
Check out "Define Value Lists" and look at the list "Related Models". Note how "Use Value from Field" is marked. (Click "specify field" to the right of that radio button to see more.)

You'll see we use values from the field "ModelName" in the table "Models".

If you want to enter new models, you'll navigate to the layout called "Model".

HTH.