Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show fields based on value list

Status
Not open for further replies.
Jan 29, 2002
30
GB
Hi,

I am looking to have 3 fields hidden in a layout. When a user selects option 1 in the value list 1 of the fields are displayed. When they select option 2 2 fields are displayed and so on for option 3.

But im not sure how to go about it.

Cheers
james
 
I am not clear on what you want to do. You mentioned hidden fields and it sounds like you want the contents of these fields to display when a value is selected by the user.

First you can have one field with three different contents. Let's say the user selects Option 1 from a value list or radio button. The next field can contain a constrained list with all of it's values pertaining to the selection of Option 1.

Are you working with a drop down list? Am I correct in assuming the content of list 2 is dependent on the selection is list 1?

If you need to have 3 hidden fields, with the value selected by the user, this can be done very easily too. Are the contents of these hidden fields a drop down list or menu?

Hidden fields are done with a portal. You have a constant, which is a calculation field, = 1 is all the calculation needs be and you need a field to match that to.

For example, define 3 calculation fields for 3 visibility options that will look at the users selection and return a value of 1.

Field 1: Visibility Option 1, calculation=
Case(Field 1 = "Option 1",1)

Field 2: Visibility Option 2, calculation=
Case(Field 1 = "Option 2",1)

Field 3: Visibility Option 3, calculation=
Case(Field 1 = "Option 3",1)

Now when option one is selected, a value of 1 is returned. Define a relationship where the File 1.fp5 is on both side of the relationship, Field 1 is going to compare with the constant field and when the value of 1 matches, the portal is displayed. When it is not, the field will not display on your layout. It disappears.

This can be tweeked to display fields 1 and 2 when option 2 is displayed like this:

Field 1: Visibility Option 1, calculation=
Case(Field 1 = "Option 1",
Case(Field 1 = "Option 2",1,
Case(Field 1 = "Option 3",1)

Field 2: Visibility Option 2, calculation=
Case(Field 1 = "Option 2",1,
Case(Field 1 = "Option 3",1)

Field 3: Visibility Option 3, calculation=
Case(Field 1 = "Option 3",1)

As you read the code above, you can see that someone selecting option 3 will return a 1 value for all 3 fields. This will in turn display all 3 portals.

Now that the relationship is defined, drag a portal window onto your display and select the first relationship and so on. Then drag a field onto the portal that you want to be displayed with each portal selection.

This may sound complicated but it is a simple concept. I can go into greater detail if you don't follow this.

Let me know.

Marty
 
The calculation says "There are more ( than there are )"

And the databasepros site is down!!

Cheers
James
 
Ok,

I have got the sample "Visible" file from database pros. Works ok but what i am after is a pull down menu where you select option 1 and text 1 field is shown. If you select option 2 then text 1 and text 2 fields are shown. When you select option 3 all 3 fields are shown.

Am I not making sense?

James
 
Am I not making any sence?

The solution to display a text field based on a selection is in my last post. I also ask several questions about your solution to better understand your needs.

So far visibility sounds like the answer to your question. And the answer is posted. If you would respond to my post about what is not clear or that you don't understand, I could further define the answer to your solution.

Marty
 
Hi there,

Ok thanks for the help with this, I have got a full solution by looking at the Visible file on database pros and using the code above. Details below.

Define Fields:

Text 1 - Text
Text 2 - Text
Text 3 - Text

Visibility_1 - Calculation =
Case(Vis_Opt = "Option 1",1,
Case(Vis_Opt = "Option 2",1,
Case(Vis_Opt = "Option 3",1))

Visibility_2 - Calculation =
Case(Vis_Opt = "Option 2",1,
Case(Vis_Opt = "Option 3",1))

Visibility_3 - Calculation =
Case(Vis_Opt = "Option 3",1)

Vis_Opt - Text - By Value List - Set as popup menu in layout

Constant - Calculation = 1

Define Value List

List Name = Options - "Option 1,Option 2, Option 3.

Define Relationships (All to self)

Name: Constant_Rel - Constant=::Constant
Name: Vis1_Rel - Visibility_1=::Constant
Name: Vis2_Rel - Visibility_2=::Constant
Name: Vis3_Rel - Visibility_3=::Constant

Drag 3 portals to the layout & reference each portal to each Vis#_Rel relationship.

Drag Text 1 field to the portal related to Vis1_Rel
Drag Text 2 field to the portal related to Vis2_Rel
Drag Text 3 field to the portal related to Vis3_Rel

Go to browse mode and give it a go!! and it should work!

So when you select option 1 from the menu text field 1 is shown, when you select option 2 text field 1 and 2 are shown, and when selecting option 3 all 3 fields are shown.

Cheers for the help
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top