Page 1 of 1

Form Input-Global Value List

PostPosted: Sun Sep 10, 2017 6:35 am
by jehanzeb
I have three tables i.e. Regions, Countries and Cities all related correctly.
I am designing a form with three combo boxes to input Regions, Countries and Cities. For obvious reasons, I have chosen to use a global table with global_value_list for each box.
But I would also like to filter the two comboboxes i.e.Countries and Cities combos to display filtered lists instead.
I mean countries list should display according to selected Region and Cities list should be filtered according to Country selected.

Regrettably, I am new to servoy and if the questions eems below standard, my apologies in advance. Help, of course shall be much appreciated.

Re: Form Input-Global Value List

PostPosted: Mon Sep 11, 2017 5:49 pm
by sean
Hi,

It should be possible. You can base countries on countries table. Then you can base regions and cities on relations.
This approach requires no code, but the challenge with this setup, is that these (non-global) relations only works on the context of the form's selected record.

So what does the record that you edit look like?
Does it have FKs or relations to the tables ?
i.e. "order_to_ccountries.countries_to_regions" etc

Another approach requires just a little code.
handle the onDataChange (and maybe onRecordSelection) event to update the valuelists.
use
Code: Select all
elements.my_element.setValueListItems(jsDataSet/Array)

or
Code: Select all
application.setvalueListItems('my_value_list',jsDataSet/array)