Lookup Field Advance Customization help

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Lookup Field Advance Customization help

Post by sathukorala » 2020-11-27 04:31

I need some guidance in the below scenario, please
- I make a table with a country name column and city name column
- User selects a country as a lookup field in the second table form (eg. select Australia)
- Then the below field "city" should only show cities in Australia as a dropdown.

How can I do this?
Can't use advanced lookup field SQL query since the record is still not entered to the database.

A little help, please.....


User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1817
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field Advance Customization help

Post by jsetzer » 2020-11-27 07:22

(1)

Did you setup the tables and lookups correctly? Like this:

Countries
-id
-name

Cities
-id
-country_id (lookup cities name)
-name

If cities.country_id is a lookup to countries, the dependent dropdowns should work as expected.

(2)

You have to fill countries table first.

Then start filling cities table. On a new record in cities dv you can select a country from the dropdown.

(3)

Using data in a third table

Addresses
-id
-country_id (lookup countries name)
-city_id (lookup cities name, filter by country_id :!: )
-street
-...

If setup according to (1) and (2) is correct, there will be a checkbox "filter by country_id" when editing city_id field.

Whever you create a new address, after selecting a country, there will be cities related to the chosen country in cities-dropdown, only.
Last edited by jsetzer on 2020-11-27 07:27, edited 1 time in total.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1817
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field Advance Customization help

Post by jsetzer » 2020-11-27 07:23

PS: I have seen that you have found the solution in the meantime while I was writing an answer.

:idea: Anyway, I hope my answer will help others configuring dependent lookups in the future.

PPS: please don't double post + email the same question
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: Lookup Field Advance Customization help

Post by sathukorala » 2020-11-27 14:52

jsetzer wrote:
2020-11-27 07:22
(1)

Did you setup the tables and lookups correctly? Like this:

Countries
-id
-name

Cities
-id
-country_id (lookup cities name)
-name

If cities.country_id is a lookup to countries, the dependent dropdowns should work as expected.

(2)

You have to fill countries table first.

Then start filling cities table. On a new record in cities dv you can select a country from the dropdown.

(3)

Using data in a third table

Addresses
-id
-country_id (lookup countries name)
-city_id (lookup cities name, filter by country_id :!: )
-street
-...

If setup according to (1) and (2) is correct, there will be a checkbox "filter by country_id" when editing city_id field.

Whever you create a new address, after selecting a country, there will be cities related to the chosen country in cities-dropdown, only.
Thanks for the descriptive answer

Post Reply