01-23-2019 12:42 AM
Hello,
is there a possibility to configure two pickers for example picker A for countries
and picker B for cities where you first select country in picker A
and picker B only shows all cities which belong to chosen country?
Picker A and B should get their infos from database:
for example:
table A: list of country
table B: list of country, city
Regards,
Iris
Solved! Go to Solution.
01-23-2019 06:23 AM
Hi Iris,
here is an example how to define depending pickers:
<Entity Id="Countries" Table="countries" Key="id" SyncType="Automatic"> <Field Name="id" Type="Guid" IsRequired="True" /> <Field Name="name" Type="String" IsRequired="True" /> </Entity> <Entity Id="Cities" Table="cities" Key="id" SyncType="Automatic"> <Entity.Filters> <Filter Id="CountryFilter" Sql="country_id = @{country_id}" /> </Entity.Filters> <Field Name="id" Type="Guid" IsRequired="True" /> <Field Name="country_id" Type="Guid" IsRequired="True" /> <Field Name="name" Type="String" IsRequired="True" /> </Entity> <Picker Name="country_id" Title="Country" KeyMember="id" DisplayMember="name" Items="{Entity Countries}" /> <Picker Name="city_id" Title="City" KeyMember="id" DisplayMember="name" Items="{Entity Cities, Filter=CountryFilter}" />
Regards
Christian
01-24-2019 04:18 AM
Great, that works!
Assuming there are multiple entries of one city in table 'cities' (due to additional informations)
is there a way to only show distinct results in picker city_id?
Thank you very much,
regards, Iris
01-25-2019 02:28 AM
Hi Iris,
the easiest way would be to create a database view which gives you a distinct result of your cities.
Regards
Christian
03-15-2019 09:43 AM
Hi,
I created a database view to have a distinct list of my object.
And how can I use this database view in my picker? I tried it with a new Entity in the Shell.xaml but it doesn't work.
Regards, Maike