Kexi/Handbook/Building Simple Databases/Designing Forms/Assigning data sources: Difference between revisions

From KDE Wiki Sandbox
(Marked this version for translation)
(Merging Burkhards fixes to k.d.o version)
Line 4: Line 4:


<!--T:2-->
<!--T:2-->
The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the <menuchoice>Data Source</menuchoice> tab of the '''Property''' pane.  
The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the <menuchoice>Data Source</menuchoice> tab of the '''Property Editor''' pane.  


<!--T:3-->
<!--T:3-->
The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table persons as a data source for your new form.
The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table '''''Persons''''' as a data source for your new form.


<!--T:4-->
<!--T:4-->
Line 13: Line 13:
<translate>
<translate>
<!--T:11-->
<!--T:11-->
# Switch to the <menuchoice>Data Source</menuchoice> tab and enter persons table name in the '''Form's data source''' drop down list. Alternatively, you can select this name from the drop down list.  
# Switch to the <menuchoice>Data Source</menuchoice> tab and enter '''''persons''''' table name in the '''Form's data source''' drop down list. Alternatively, you can select this name from the drop down list.  


<!--T:5-->
<!--T:5-->
Line 22: Line 22:
<translate>
<translate>
<!--T:12-->
<!--T:12-->
# In the <menuchoice>Data Source</menuchoice> tab of the property pane enter field name name in the '''Widget's data source''' drop down list. Alternatively, you can select this name from the drop down list. </translate>
# In the <menuchoice>Data Source</menuchoice> tab of the property pane enter field name '''''name''''' in the '''Widget's data source''' drop down list. Alternatively, you can select this name from the drop down list. </translate>
<translate>
<translate>
<!--T:13-->
<!--T:13-->
Line 31: Line 31:


<!--T:7-->
<!--T:7-->
You can now save the form's design (this is not mandatory to test the form in action). To save, click the <menuchoice>Save object changes</menuchoice> toolbar button or use the <menuchoice>File-> Save</menuchoice> (<keycap>Ctrl+S</keycap>) menu command. Upon saving you will be asked for entering the form's name. Enter '''''Persons''''' as caption and click the <menuchoice>OK</menuchoice> button. The form's name will be filled automatically.  
You can now save the form's design (this is not mandatory to test the form in action). To save, click the <menuchoice>Save</menuchoice> toolbar button<!--FIXME no File menu nor shortcut in master/2.4.0 or use the <menuchoice>File-> Save</menuchoice> (<keycap>Ctrl+S</keycap>) menu command-->. Upon saving you will be asked for entering the form's name. Enter '''''Persons''''' as caption and click the <menuchoice>OK</menuchoice> button. The form's name will be filled automatically.  


<!--T:8-->
<!--T:8-->
This is the right moment for testing your form. Click the <menuchoice>Switch to data view</menuchoice> toolbar button. Unless you made a mistake while entering data sources, you should see form's fields filled with data from the persons table.
This is the right moment for testing your form. Click the <menuchoice>Data</menuchoice> toolbar button. Unless you made a mistake while entering data sources, you should see the form's fields filled with data from the '''''Persons''''' table.
   
   
{{Note|
{{Note|
* If you want to remove widget's data source assignment for a form widget, you can use <menuchoice>Clear widget's data source</menuchoice> button near the '''Widget's data source''' drop down list. Similarly, you can use the <menuchoice>Clear form's data source</menuchoice> button near the '''Form's data source''' drop down list. <!--}}-->
* If you want to remove widget's data source assignment for a form widget, you can use the little black icon with a  white cross at the right in the <menuchoice>Widget's data source</menuchoice> box.<!--FIXME not in master/2.4 <menuchoice>Clear widget's data source</menuchoice> button near the '''Widget's data source''' drop down list. Similarly, you can use the <menuchoice>Clear form's data source</menuchoice> button near the '''Form's data source''' drop down list.--><!--}}-->


<!--T:15-->
<!--T:15-->

Revision as of 15:28, 7 April 2012

Other languages:

Assigning data sources

The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the Data Source tab of the Property Editor pane.

The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table Persons as a data source for your new form.

  1. Click on the form's surface, as you will alter its properties.
  2. Switch to the Data Source tab and enter persons table name in the Form's data source drop down list. Alternatively, you can select this name from the drop down list.

You have assigned form's data source. Now you need to do specify widget's data source.

  1. Click the first text field widget at the top of the form.
  2. In the Data Source tab of the property pane enter field name name in the Widget's data source drop down list. Alternatively, you can select this name from the drop down list.
  3. Click on next text field widget and enter surname as the data source.
  4. Enter data sources for street, house_number and city text fields in a similar way.

You can now save the form's design (this is not mandatory to test the form in action). To save, click the Save toolbar button. Upon saving you will be asked for entering the form's name. Enter Persons as caption and click the OK button. The form's name will be filled automatically.

This is the right moment for testing your form. Click the Data toolbar button. Unless you made a mistake while entering data sources, you should see the form's fields filled with data from the Persons table.

Note
* If you want to remove widget's data source assignment for a form widget, you can use the little black icon with a white cross at the right in the Widget's data source box.
  • Use the Go to selected form's data source button to select appropriate table or query in the Project Navigator, so you can quickly open a table or query being the data source of the form.