Contents:
Introduction
News blog
What is Servoy?
Getting Started
Comparison Servoy/VFP
Performance
How-To's
Code Reference
VFP2Servoy Toolkit
Contact / feedback
|
How to create and use a table-based valuelist
Table Values (all values from a certain table)
Although custom values are very easy to use many developers will want to use the table value option instead.
The custom values are hard-coded into the application and should their value change then a new build is
inevitable.
Suppose we have a customer table (you may want to create it in your test database) with a country field (type integer) and a country table with the following fields:
We want to add a combobox to our form that shows the countrycode and the countryname seperated by a "-". Furthermore the
numeric identity of the country should be stored in the customer table. Now in VFP that wouldn't be too much code would it?
In Servoy no code is required at all! Follow these steps:
- Create a country table as shown above
- Click on the database in the Solution Explorer
- Select the country table in the List View (lower left corner) and right-click it
- From the menu select Create new form
- Click the Next button and select the three columns
- Make sure the checkboxes are checked as in the screenshot below
- Press Finish and run the form
- Add a few countries
- Create a new Valuelist as described in the previous walkthrough
- Use the settings shown below:
As you can see the first two columns (country_code and country_name) have been checked to be shown in the field/list (combobox).
Also you can see that in the seperator field " - " has been specified that the two columns should be seperated by a - (surrounded with spaces).
Finally the third column (country_id) has been specified as the column from which the value is to be used to store in the database (vfp: bound column). This is
done by checking Return in dataprovider.
Next we want to add a combobox to our form that use the valuelist:
- From the toolbar click the textbox button
- Select the country field from the customer table and press Ok
- Select the country textbox control in your form
- Change the displayType property to COMBOBOX
- Fill the valuelist property with the Countries valuelist you just made
- Set the horizontalAlignment property to LEFT
- Run the form
|
External resources:
vfp plugin
ServoyWorld 2012 pics
Official Servoy website
Ken Levy on Servoy
Servoy info
Servoy Forum
Servoy Documentation
|