Selective lookup

Consider a form with two dialog boxes. Dialog Box One contains five options. Once you select one of the five, the list of options in Dialog Box Two changes accordingly.

As an example, imagine Dialog Box One contains a list of car manufacturers (GM, Honda, Ford, Volvo and BMW). After you select one of the companies (say, Ford), Dialog Box Two should only show car models built by the company in Dialog Box One (Focus, Taurus, F150, Mustang, and Explorer). Don’t display Corvette, Accord, XC90, or Z8 by the other manufacturers.

I have a feeling this is an easy one, but since I’ve not done it before, I could use some direction. Thanks.

Subject: RE: Selective lookup

You’re saying dialog box and I think you’re actually talking about keyword fields.

Yes, you can do that. Exactly how depends on whether you are hardcoding the relationships between the values in field 1 and the choices in field 2, or doing a lookup. Let’s suppose it’s the latter since that’s both more common and generally easier to maintain. So you have a view of some reference documents sorted by field1, which also contains a column of possible field2 values. Field1 is set to “refresh fields on keyword change” and field2 is set to “refresh choices on document refresh”. The keyword formula for field1 is perhaps:

@IfError(@DbColumn(“”; “”; “SomeView”; 1); "Error: " + $Error + “|”)

The keyword formula for field2 might then be:

@If(field1 = “”; “”; @IfError(@DbLookup(“”; “”; “SomeView”; field1; 2); “”)

In addition, you need to do something to deal with the situation of someone enteringa value in field1, then in field2, then changing the value in field1 to something not compatible with the value in field2. This could be done with an input translation formula in field2, e.g.:

@If(field1 = “”; “”; @IsMember(@ThisValue; @IfError(@DbLookup(“”; “”; “SomeView”; field1; 2); “”)); @ThisValue; “”)

Subject: RE: Selective lookup

Thanks for the suggestion – I’ll give it a try today.

I double checked, and the fields that I am describing on the form are of type Dialog Box. I don’t see an option for Keyword Field (I see Listbox, Combobox, Checkbox, etc., but no Keyword). I don’t mean to split hairs, but do you think this will cause the formulas not to work?

And you’re correct – I am expecting to do this via a lookup of a view as opposed to hard coding it.

Thanks again.

David

Subject: RE: Selective lookup

“Dialog Box” refers to any modal dialog. Saying you have a form “with” dialog boxes doesn’t make sense.

What you have are dialog box fields. The fields are not dialog boxes – they use dialog boxes to show the list of choices. The generic term that includes these and other types of fields that present the user with a list of choices, is “keyword fields.”

The technique I described should work with any kind of keyword field.

Subject: RE: Selective lookup

Thanks for clarifying that. Again, I appreciate your help with the lookup.