Data Table

From PresenceWiki
Revision as of 12:29, 17 June 2010 by Admin (Talk | contribs)

Jump to: navigation, search

Data Table

The Data Table is an object stored in memory as part of the Presence Context. It consists of a series of rows divided into named columns:

http://www.international-presence.com/wikidocs/images/data_table_view.png

Populating the Data Table

The Data Table is automatically populated and appended by Query Task Elements. For example the SQL Query Node will populate the Data Table with the results of the database query, using the Column names and values that are returned in the record set.

Merging Data Tables

The Merge Results Node will merge one ore more Data Tables with either horizontal, vertical or cross-reference strategy.

Joining New Results

If a Data Table is already present in the Presence Context and a new query is performed, the results will be appended to the existing Data Table. If the results of the current (incoming) Data Table are referenced in the new query, the new results will be joined in a logical fashion. For example:

Query A creates a Data Table with the columns 'A', 'B' and 'C'.

This joins to Query B, which returns a Data Table with the columns 'D' and 'E'.

If Query B contains a reference to Column 'A' (for example in the WHERE clause), the query will be repeated for each possible value of 'A' and the subset will be joined to the correct records.

Iteration Strategies

Presence uses implicit iteration. This means that if a Task Element's settings contain a reference to one or more column names, the Task Element's functionality will be repeated for each unique value for the column(s) referenced.

For example, the Send Email node allows you to use a Column reference to form the subject (as well as the message body, attachments and recipients). Imagine we have a Data Table which contains a Column named 'EMAIL_SUBJECT' and has five rows of data, each with a distinct value for EMAIL_SUBJECT.

We would reference this Column by placing the following value in the Email Subject field:

 :var{EMAIL_SUBJECT}

As a result of this a separate email with a unique subject will be generated for each value of EMAIL_SUBJECT in the Data Table.