On 2023-09-12 12:59:32 +0000, Martin Τrautmann said:
>
> Hi all,
>
> up to now I used scripted versions to set a mark flag on the fields that
> I wanted to pop up in value lists.
>
> But this time I tried once again to use popup values direcly and failed
> miserably.
>
> What I want to do is e.g. a "people" database with the fields "state"
> and "city".
>
> The state field is entered first, taking its values from the state field
> itself (value list "state", from the entries of field "state").
>
> City should be suggested, aaccording to the selected state.
>
> Cities are within another table, taken e.g. from
> <
https://gist.githubusercontent.com/Miserlou/11500b2345d3fe850c92/raw/e36859a9eef58c231865429ade1c142a2b75f16e/gistfile1.txt>
>
>
> Relation "cities" is from people::state to cities::state
>
> When I take people::town as the first field, cities::town as the second
> field, that is
> * first field: people::town
> * secondary field: cities::town
> * include only related values starting from "cities"
> * show values only from second field
>
> Oh use a drop down list, which looks best in table view (and behaves the
> same in ther views), while a popup list works exactly the same.
>
> That's the closest thing to what I need. But when I got e.g. 20 people
> from California already, the value list repeats each of the cities 11
> times. 9 people from Colarado, the value list shows each city 3 times.
> So it's ok only if there's just one state entry, resulting in one
> offerend city
>
> It does not depend on the number of found records how many repetitions I
> see, but the number of records that do contain a matching state field.
>
>
> When I use different setups,
> * I do get e.g. all cities, once, but not filtered by state
> * I do get all filtered cities, just once, but selecting one does
> not enter the selected city, but its state only
>
> Where is my mistake, how would I do it properly?
>
> Or is that a FMP11 but which was fixed later on?
>
>
> Thanks
> Martin
I'm not sure quite why you need to bother with "first fields" and
"secondary fields". That's probably part of the weirdness you're seeing.
The usual option to have have a separate table, e.g. StatesCities,
which has two fields:
LookupState Text
LookupCity Text
Into this table you can import the needed data from the text file in your link.
Back in the People table you need a two user data enty fields:
UserState Text
UserCity Text
Now you need a relationship link that connects the data entered in
UserState to the list of appropriate cities from the StatesCities table:
rel_LookupCity People::UserState = StatesCities::LookupState
You also need to create two value lists:
vl_StateList values from field StatesCities::LookupState
include all values
vl_CityList values from field StatesCities::LookupCity
include only related values from rel_LookupCity
Put the two data entry fields on the layout and format them as
Drop-down lists using the appropriate value list.
i.e.
UserState Drop-down list, values from vl_StateList
UserCity Drop-down list, values from vl_CityList
All done.
When the user clicks on the UserState field they get a list of all the
states (alphabetically sorted) to choose from. Once they select a
state, the UserCity field will have a list of only the appropriate
cities (alphabetically sorted) for that state.
Helpful Harry :o)