ProtoDB Reader
Introduction
The ProtoDB Reader provides read access to ProtoDBs stored in a personal or shared repository. To recall a stored ProtoDB, select one from the displayed ProtoDB list in the Property Panel. The selected ProtoDB becomes immediately available as an entryset via the "Get Entryset" output connector.
Advanced Query Mode
To effectively work with larger data sets ProtoDB Reader supports an advanced query mode which can return a subset of the data in a ProtoDB. These queries are similar to a SQL SELECT statement. Advanced query mode can be activated by opening the Property Panel of a ProtoDB Reader module, selecting the "Query" tab and selecting the "Enable Advanced Query Mode" check box.
Once advanced query mode is enabled, queries can be performed in one of two ways. The first uses the visual query builder in the Property Panel. This is enabled by selecting "Visual Query Builder". The second mode allows specifying simple SQL SELECT statements. This is enabled by selecting "Use SQL Query Input Connector".
For the specific usage of the various fields in the "Query" tab of the Property Panel refer to the Property Panel reference below.
Visual Query Builder
The visual query builder is used to construct conditional statements to select from the ProtoDB. Input connectors are dynamically created which correspond to the conditions in the statement allowing the data selected from the ProtoDB to be changed on the fly.
The attributes specified in "Select Attributes" in the Property Panel are the ones that are output by the ProtoDB Reader. Individual conditional clauses are created by selecting cells from the AND and OR grid in the visual query builder and then specifying an attribute to compare against, a comparator, and a comparison value. The current query constructed by the selected options is displayed in the "Where" field at the bottom of the Property Panel. By sending values to the associated input connectors, the comparison value for each conditional clause can be altered.
SQL Input Connector
When "Use SQL Query Input Connector" is selected in the Property Panel an input connector is created for the ProtoDB Reader which accepts text. The SELECT SQL query used as input to this connector is then executed against the ProtoDB. When writing these statements, they must always be performed against "data" regardless of the name of the ProtoDB that is being queried.
For example, if a ProtoDB has two columns: "description" of type text and "count" of type number a query could be performed which selected only descriptions with a value greater than five in the count attribute. Such a query would read "SELECT description FROM data WHERE count > 5". Aliasing of attributes is also possible, allowing the attributes to be renamed for output. To change the "description" attribute to "name" on output the query "SELECT description AS name FROM data WHERE count > 5" could be used.
In addition to always selecting from "data" there is another subtlety to executing SQL queries directly against a ProtoDB. There is a metadata attribute called [__ID__] for every entry in the entryset stored in a ProtoDB. This attribute is not shown in the output of the entryset if, for example, it was being displayed in the Viewer. However, it is is necessary to select this metadata attribute to perform updates on specific entries. Using the above example again, if the goal is to allow updates of the dsecription of all attributes with a count greater than 5 the query "SELECT [__ID__], description FROM data WHERE count > 5" can be used. The output can then be sent to a Table for editing in the Viewer, then sent back to a ProtoDB Writer connected to the same ProtoDB. The entries changed in the Table would then be updated in the ProtoDB.
Property Panel:
ProtoDB Reader Properties
- Select Database
- Select the ProtoDB to read from.
- View
- Filters which ProtoDBs are displayed in the "Select Database" list according to their permissions.
- Description
- Describes the currently selected ProtoDB.
- Receive Update Notifications
- Toggles whether or not a shared ProtoDB should immediately refresh its data when it is updated elsewhere.
- Use assigned types and defaults
- Toggles whether or not to read data using the types configured for the ProtoDB or to read out everything as text.
- Manage Databases...
- Opens a window that allows you to manage your ProtoDBs. Described below.
Database Repository Manager
The window opened with the "Manage Databases..." button in the property panel.
- Create New Database
- Opens a window that can define a new ProtoDB.
- Database Name
- The list of available ProtoDBs.
- View
- These selections filter which ProtoDBs are visible in the "Database Name" list: all of them, just private, or just public.
- Delete
- Deletes the selected ProtoDB.
- Import
- Imports an existing ProtoDB.
- Export
- Exports the selected ProtoDB.
Selected Database
- Name
- The selected ProtoDB's name.
- Description
- The selected ProtoDB's description.
- Edit
- Enable editing the ProtoDB's name and description.
- Apply
- Save the changes to the ProtoDB's name and description.
- Cancel
- Discard the changes to the ProtoDB's name and description.
Action
- Edit Structure...
- Opens a window to edit the attributes of the selected ProtoDB.
- View Contents...
- Opens a window to view the contents of the selected ProtoDB.
- Edit Permissions...
- Opens a windows edit the access permissions of the selected ProtoDB.
Query
Specify a query to return specific data from a ProtoDB
- Enable Advanced Query Mode
- Toggles advanced query mode using either the visual query builder or a SQL query string.
- Use Visual Query Builder
- Enables the query building functionality and the "Query Conditions" input connectors.
- Use SQL Query Input Connector
- Disables the query building functionality and enables the "Execute SQL Query String" input connector.
- Select Attributes
- Select which attributes will be returned by the query.
- Reset Conditions
- Remove the existing query conditions.
- Edit Conditions
- Select a query condition to edit or select where to add a new condition.
- Add Condition
- Add a new condition at the selected location.
- Update Condition
- Apply the changes made to the selected condition.
- Remove Condition
- Remove the selected condition.
- Choose Attribute
- Select the attribute to be used in the condition.
- Choose Comparator
- Select the method of comparison for the condition.
- Enter Comparison Value
- Specify the value to compare the attribute value against using the comparator.
- Where
- Displays the current query string constructed by the visual query builder settings.
See Also:
Input Menu:
Set Proto Database
Sets the ProtoDB from which data is read.
Accepted Datatypes:
- Text
- The name of a currently accessible ProtoDB.
Triggered Outputs:
- Output Message:
- Get Data
- Output Message:
- Get Database Name
Set Receive Notifications
Sets whether or not to reload the selected ProtoDB when it receives a notification that it has been updated elsewhere.
Accepted Datatypes:
- True/False
Do Refresh Database
Re-reads the contents of the selected database and sends an updated entryset to the "Get Entryset" output connector.
Accepted Datatypes:
- True/False
Triggered Outputs:
- Output Message:
- Get Data
Query Conditions → [Condition Value] (Dynamic Menu)
Set the comparison value for the specified query condition.
Accepted Datatypes:
- Any
Triggered Outputs:
- Output Message:
- Get Data
Execute SQL Query String
Set a SELECT SQL query and execute it against the ProtoDB.
Accepted Datatypes:
- Text
Triggered Outputs:
- Output Message:
- Get Data
Output Menu:
Get Data
Gets an entryset containing the data stored in the selected ProtoDB.
Output Datatype:
- Entryset
Triggered By:
- Input Message:
- Set Database
- Input Message:
- Do Refresh
Get Database Name
Gets the name of the currently selected ProtoDB.
Output Datatype:
- Text
Triggered By:
- Input Message:
- Set Proto Database