Is it possible to save a method-generated value list?

I have a form with an address field that must be filled using a valuelist generated by an SQL query. The valuelist obviously varies according to the city which the form refers to.

The valuelists are generated everytime the city changes. This is generally executed very fast, except in the case of large cities that have thousand of street names.

The question is: is it possible to save these lists and call them programmatically or there is another way to get the same result?

Rioba,

There are a number of ways to do this. Here’s a couple of approaches for starters:

  1. Set up a relation to a Street Addresses table from a Cities table. You will need to put the key to the City into your data gathering table (Name and Address?). I have a similar situation here. By using this methodology you do not need to issue custom sql queries all the time as the addresses for a given city are simply on a child-side relation (one:many). I originally used the custom sql approach but found an approach using conventional Servoy methods (relation) easier and faster. You will need a City table (parent) and Addresses_for_a_City table (child, 1:M).

  2. If you prefer the custom sql approach you can save the sql call string (“select … where …”) in a database column and load it into memory. Be very careful here to avoid security intrustions when you bind the sql string: make sure this table is reasonably secured.

Best,

Michael