Difference between revisions of "Setting DataSource Contexts"

From Documentation
Jump to: navigation, search
(Marked this version for translation)
Line 1: Line 1:
 
<translate>
 
<translate>
==Setting DataSource Contexts (or Repetitive Region)==
+
==Setting DataSource Contexts (or Repetitive Region)== <!--T:1-->
 
A Data Source Context is in fact an HTML tag that is repeated dynamically in order to display information from a defined recordset (XML or Data Base). The Data Source Context is a repetitive region that imports all the information from a database. If you are querying a database and want to return only one record that matches the condition FirstName = Joe, then you need a WHERE condition in the recordset, but you do not need to add a data source context. The query will return all the records meeting that condition, then terminate. However, if you want to return all records in which FirstName = Joe, you will need to add a repetitive region so that all records in the database are searched and those meeting the condition will be returned.
 
A Data Source Context is in fact an HTML tag that is repeated dynamically in order to display information from a defined recordset (XML or Data Base). The Data Source Context is a repetitive region that imports all the information from a database. If you are querying a database and want to return only one record that matches the condition FirstName = Joe, then you need a WHERE condition in the recordset, but you do not need to add a data source context. The query will return all the records meeting that condition, then terminate. However, if you want to return all records in which FirstName = Joe, you will need to add a repetitive region so that all records in the database are searched and those meeting the condition will be returned.
  
 +
<!--T:2-->
 
In NetObjects Fusion, you may define as many repetitive regions as you want, but there are only three object types that can be configured as repetitive regions:  
 
In NetObjects Fusion, you may define as many repetitive regions as you want, but there are only three object types that can be configured as repetitive regions:  
 
* Layout Region. If the Layout Region is placed within a Multi Layout Region, then only one Layout Region can be a repetitive region.
 
* Layout Region. If the Layout Region is placed within a Multi Layout Region, then only one Layout Region can be a repetitive region.
Line 8: Line 9:
 
* Multi Layout Region. Any Multi Layout Region can be configured as a data context, if you have previously defined a database or an XML recordset. All the actions targeting a repetitive region on a Multi Layout Region have to target the container containing the Multi Layout Region (not the Multi Layout Region itself). The Multi Layout Region can be configured as a data source context only with PHP.
 
* Multi Layout Region. Any Multi Layout Region can be configured as a data context, if you have previously defined a database or an XML recordset. All the actions targeting a repetitive region on a Multi Layout Region have to target the container containing the Multi Layout Region (not the Multi Layout Region itself). The Multi Layout Region can be configured as a data source context only with PHP.
  
==Defining a Layout Region as a Data Source Context==  
+
==Defining a Layout Region as a Data Source Context== <!--T:3-->
 
# In Page view, select the Layout Region tool from the Standard toolbar.
 
# In Page view, select the Layout Region tool from the Standard toolbar.
 
# Draw on the page the layout region location.
 
# Draw on the page the layout region location.
Line 25: Line 26:
 
Now the Layout Region is a Data Source Context that retrieves information from the selected recordset.
 
Now the Layout Region is a Data Source Context that retrieves information from the selected recordset.
  
 +
<!--T:4-->
 
You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click a navigation element that will display the next set of records. See [[Adding_Dynamic_Content_from_a_Database#Navigating_Through_Recordsets|Navigating Through Recordsets]].
 
You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click a navigation element that will display the next set of records. See [[Adding_Dynamic_Content_from_a_Database#Navigating_Through_Recordsets|Navigating Through Recordsets]].
  
==Defining a Row of a Table as a Data Source Context==  
+
==Defining a Row of a Table as a Data Source Context== <!--T:5-->
 
# In Page view, select the Table tool from the Standard toolbar.
 
# In Page view, select the Table tool from the Standard toolbar.
 
# Draw a box on the Layout to indicate where you want to position the Table.
 
# Draw a box on the Layout to indicate where you want to position the Table.
Line 35: Line 37:
 
'''Note: You cannot define a row as a Data Source Context into a page that does not have a Connector already added.'''
 
'''Note: You cannot define a row as a Data Source Context into a page that does not have a Connector already added.'''
  
 +
<!--T:6-->
 
The Data Source Region dialog appears.
 
The Data Source Region dialog appears.
 
<ol start="6">
 
<ol start="6">
Line 44: Line 47:
 
Now the row is a Data Source Context that retrieves information from the selected recordset.
 
Now the row is a Data Source Context that retrieves information from the selected recordset.
  
 +
<!--T:7-->
 
You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click the navigation elements that will display the next set of records. See [[Adding_Dynamic_Content_from_a_Database#Navigating_Through_Recordsets|Navigating Through Recordsets]].
 
You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click the navigation elements that will display the next set of records. See [[Adding_Dynamic_Content_from_a_Database#Navigating_Through_Recordsets|Navigating Through Recordsets]].
  
==Adding Data Fields to a Data Source Context==
+
==Adding Data Fields to a Data Source Context== <!--T:8-->
 
After you have created a Data Source Context, you may add data fields using the Text Tool, and the options from the Data Sources toolbar.  
 
After you have created a Data Source Context, you may add data fields using the Text Tool, and the options from the Data Sources toolbar.  
 
# In the Layout Region, add a text box in which type: "Name:" or what label you want.
 
# In the Layout Region, add a text box in which type: "Name:" or what label you want.
Line 85: Line 89:
 
</ol>
 
</ol>
  
==Setting Form Element as a Data Source Context==
+
==Setting Form Element as a Data Source Context== <!--T:9-->
 
You may also add form elements as Combo boxes, Check boxes or Radio buttons, to which you can specify a dynamic source for populating the options of the selected form element.
 
You may also add form elements as Combo boxes, Check boxes or Radio buttons, to which you can specify a dynamic source for populating the options of the selected form element.
  
 +
<!--T:10-->
 
'''''Note:''' Form objects must be placed in a form layout region. For information on creating forms and form object definitions, see [[Designing and Implementing Forms|Designing and Implementing Forms]].''
 
'''''Note:''' Form objects must be placed in a form layout region. For information on creating forms and form object definitions, see [[Designing and Implementing Forms|Designing and Implementing Forms]].''
  
 +
<!--T:11-->
 
The Checkbox and the Radio button can have dynamic functionality. The user can specify from the Data Source dialog a field used to determine if the button should be checked or not. This is done by comparing the value of the control with the value of the current line from the selected field.
 
The Checkbox and the Radio button can have dynamic functionality. The user can specify from the Data Source dialog a field used to determine if the button should be checked or not. This is done by comparing the value of the control with the value of the current line from the selected field.
  
==Setting a Combo Box as a Data Source Context==
+
==Setting a Combo Box as a Data Source Context== <!--T:12-->
 
To insert a Combo box:  
 
To insert a Combo box:  
 
# In Page view, select the Combo Box object from the Form toolbar.
 
# In Page view, select the Combo Box object from the Form toolbar.

Revision as of 23:20, 16 January 2015

Setting DataSource Contexts (or Repetitive Region)

A Data Source Context is in fact an HTML tag that is repeated dynamically in order to display information from a defined recordset (XML or Data Base). The Data Source Context is a repetitive region that imports all the information from a database. If you are querying a database and want to return only one record that matches the condition FirstName = Joe, then you need a WHERE condition in the recordset, but you do not need to add a data source context. The query will return all the records meeting that condition, then terminate. However, if you want to return all records in which FirstName = Joe, you will need to add a repetitive region so that all records in the database are searched and those meeting the condition will be returned.

In NetObjects Fusion, you may define as many repetitive regions as you want, but there are only three object types that can be configured as repetitive regions:

  • Layout Region. If the Layout Region is placed within a Multi Layout Region, then only one Layout Region can be a repetitive region.
  • Row of a Table. In NetObjects Fusion , only a line from a table can be a repetitive region.
  • Multi Layout Region. Any Multi Layout Region can be configured as a data context, if you have previously defined a database or an XML recordset. All the actions targeting a repetitive region on a Multi Layout Region have to target the container containing the Multi Layout Region (not the Multi Layout Region itself). The Multi Layout Region can be configured as a data source context only with PHP.

Defining a Layout Region as a Data Source Context

  1. In Page view, select the Layout Region tool from the Standard toolbar.
  2. Draw on the page the layout region location.
  3. In the Layout Region Properties panel, enable the Data Source Context option.

Note: You cannot define a Layout Legion as a Data Source Context into a page that does not have a Connector already added.

  1. Click the DS Config button.

The Data Source Region dialog appears.

  1. Select the recordset being queried from the Recordset drop-down list.
  2. By default, the Enable pagination option is selected and you can set how many records you want to retrieve from the database. If you disable this option, all the entries will be displayed on this page. If not, you need to create navigation elements. See Navigating Through Recordsets.
  3. In the Records per page, specify the number of records returned to display on a page.
  4. Click OK.

Now the Layout Region is a Data Source Context that retrieves information from the selected recordset.

You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click a navigation element that will display the next set of records. See Navigating Through Recordsets.

Defining a Row of a Table as a Data Source Context

  1. In Page view, select the Table tool from the Standard toolbar.
  2. Draw a box on the Layout to indicate where you want to position the Table.
  3. Select a row of the table that you want to define as a repetitive region.
  4. In the Table Raw Properties panel, enable the Data Source Context option.
  5. Click the DS Config button.

Note: You cannot define a row as a Data Source Context into a page that does not have a Connector already added.

The Data Source Region dialog appears.

  1. Select the recordset being queried from the Recordset drop-down list.
  2. By default, the Enable pagination option is selected and you can set how many records you want to retrieve from the database. If you disable this option, all the entries will be displayed on this page. If not, you need to create navigation elements. See Navigating Through Recordsets.
  3. In the Records per page, specify the number of records returned to display on a page.
  4. Click OK.

Now the row is a Data Source Context that retrieves information from the selected recordset.

You can add navigation links to the page so that if more records are returned from the query than displayed on the page, you can click the navigation elements that will display the next set of records. See Navigating Through Recordsets.

Adding Data Fields to a Data Source Context

After you have created a Data Source Context, you may add data fields using the Text Tool, and the options from the Data Sources toolbar.

  1. In the Layout Region, add a text box in which type: "Name:" or what label you want.
  2. Point the mouse after the Name label.
  3. From the Data Source toolbar, click the Insert field button.

The Data Sources panel appears.

  1. Select which data to query.
  2. The first entry will be automatically displayed in Page Design.
  3. Within the first Layout Region, add a new Layout Region.
  4. Select the Layout Region and enable Data Source context option in Layout Region Properties panel.
  5. Click the DS Config button to establish a recordset for the DataSource context.

Disable the Pagination option.

  1. In the second Layout Region, add a new text box and type Jobs.
  2. Point the mouse after the Jobs label.
  3. From the Data Source toolbar, click the Insert field button.

The Data Sources panel appears.

  1. Select which data to query.

The first entry will be automatically displayed in Page Design.

  1. Publish the site to see or navigate all the entries.
  2. You should have as many names as there are in the database. Under each name, you should have as many jobs as there are in the database, under that particular Name.

To insert a field label that will retrieve its data from a database:

  1. In Page view, select the Insert Field Label object from the Form toolbar.
  2. Click in the form region to indicate the Label's location.
  3. From the Data Sources toolbar, click the Insert Field button.

Note: The insert Field is enabled if there is a Connector already added. The DataSources panel appears.

  1. Select the recordset you want to work with.
  2. Select the data field you want to be displayed.
  3. Click the OK button.

Setting Form Element as a Data Source Context

You may also add form elements as Combo boxes, Check boxes or Radio buttons, to which you can specify a dynamic source for populating the options of the selected form element.

Note: Form objects must be placed in a form layout region. For information on creating forms and form object definitions, see Designing and Implementing Forms.

The Checkbox and the Radio button can have dynamic functionality. The user can specify from the Data Source dialog a field used to determine if the button should be checked or not. This is done by comparing the value of the control with the value of the current line from the selected field.

Setting a Combo Box as a Data Source Context

To insert a Combo box:

  1. In Page view, select the Combo Box object from the Form toolbar.
  2. Click in the form region to indicate the location of the Combo box.
  3. In the Combo box Properties panel, enable the DataSource Context option.

Note: You cannot define a Combo Box as a Data Source Context into a page that does not have a Connector already added.

  1. Click the Config button.

The DataSources panel appears.

  1. Select the recordset you want to work with.
  2. Select the data field you want to use for populating the combo box.
  3. Enable the Dynamic condition option if you want set a dynamic condition.

You may either compare the retrieved data with a field of an existing recordset or compare the data with a constant.

  1. Click the OK button.