0

Add Data Records

Description

This part offers an easy way for you to insert a data collection into a data table in the database. It is used to store data that is organized as a matrix or array, with each "column" being a different data object and each "row" being a different set.

Use

The principle use for this part is to add a group of similar records to a data table in one step, instead of cycling through the records and adding each one to a table individually.

This part is often used to store data that has been collected in a user-facing application with a Smartgrid or any application where the user answers the same set of questions for different business objects. A simple example of the kind of data structure suited to this would be collecting inputs for US states, where the user provides their answers for the capitol city, population, and land mass for each state. Using the Add Data Records part you can store all 50 rows of data into a table, where each component is saved into its own column.

It is available the Data table dropdown menu in a process node and is compatible in all LogicNets frameworks as well as in projects created without a framework.

Editor Fields

Field Name

Description/Use

Type/Options 

Optional/Mandatory 

Collection

This is the name of the data collection you want to insert into the data table.

Text

Mandatory

Data source

This is the name of the data table into which you want to insert the data.

Text

Mandatory

Columns

This is where you specify each column into which a record should be inserted and the component of the collection that should be inserted.

In the part editor, the Data object column should contain only the data object name identified in the collection--without using the $(...) construction. Note that this is different from the Add Data Record (single row) part, which specifically requires the user to define the correct data object using $(...).

A useful shortcut is to click on the [...] and the system will prepopulate the (table) column and data object fields for the full table. You can then remove those columns you do not want to update and/or include other $(...) variables that will populate the SAME information in all rows.  This is useful for adding a reference ID alongside all the table row entries; for example, the user id for the 50 state inputs.

Collection

Mandatory

Support multi-level column data-objects

By default, the system indexes the column data objects (the input for the add records) in the collection using the format collection[i][data-object]. Check this checkbox to support dots in the column data object to index a sub-container element in the collection.

This is only required with more complex data model structures.

Checkbox

Optional

Log data object

This is the data object that stores the error messages from the execution of the database parts: add data record, get data record, update data record, delete data record, and import values. If you specify the log data object, the system stores the error message and stack trace of a database part to the object if there are errors when you run the part. See the image below.

When used by multiple database parts, the Log data object stores the cumulative list of error messages from the different parts.

Text

Optional  

Reset log data object

When you check this checkbox, the system will clear the error messages from the Log data object. Typically, you should check this option in the first database part of a series of database parts. 

Checkbox

Optional  

Skip on error

When you check this checkbox, the system skips the execution of subsequent database parts linked to the same Log data object. 

Checkbox

Optional

Log Data Object Image

 

Tips and Tricks - Large Data Tables (10+ columns)

In addition to its primary purpose of writing multiple sets of data to a table, you can use this part to simplify the design process of writing a single record to a large table, a table with more than 10 columns.

When you use Add Data Record (single) each column must be populated with a data variable referenced using the $(...) construction, and you have to type them in manually. This is time consuming for large data sets, so you can use Add Data Records and update the table with ONE data set. The part works with any number of sets, including when there is only one set in the collection.

This shortcut requires that the variable names and the column names match. If so, use the [...] shortcut (1) to prepopulate the part (2) with one click.

 

Any data you want to write to the large table needs to be put into the first set of a collection, e.g. update_dataset[1]. Write user inputs to update_dataset[1].object1, update_dataset[1].object2, etc. before using the Add Data Records part to add the entire update_dataset collection to your target table.

Example

Download and import the following example project in your workspace.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 12 days agoLast active
  • 28Views
  • 3 Following

Home