Writing Data

Your projects will be writing data to files, databases, SAAS, and other targets. appRules includes activities for writing data in a variety of data sources.

InitializeTarget Activity

To write data to an appRules target, you will need to initialize the Target of the data, select the connector to use and define other properties using the InitializeTarget activity.

For example, to write data to Microsoft SQL Server, drag and drop the InitializeTarget activity from the SQL Server toolbox on to the designer and configure the properties as follows:

PostExecutionActions

You can specify whether to cache the records in a preloaded table (set a lookuppreloaded source in the project and select it here), optionally select an insert/update activity (set in the project) and execute a customfunction or a child workflow for each batch completion.

Setting Data Field values for the Active Record

Before writing records in the target data source, the values of the data fields of the active record must be set.

The table below shows the activities that can be used to set the data field values of the active record:

Inserting Records

Once the data field values in the active record have been set, you can save the new record in the target by using the SaveRecord activity.

For example, to insert record into SQL Server, drag and drop the SaveRecord activity from the SQL Server toolbox activities on to the designer.

Select the Target for inserting the record. All the field values that have been set or mapped to the current record for the selected target will be added to the data source.

Click on the Option field and Select Insert in the Configure Record Save Option Window

To retrieve the key of the newly created record, tick the Retrieve New Record Key box. The key value will be made part of the target record after inserting the record (to be used for example to generate a related record in the following processed activities).

You can also define optional properties for including more field values to save and also for logging detailed errors associated with adding the new record. To define optional details, click the Optional properties button. The following window will be displayed:

Enter the property values as follows:

Updating Records

Existing records can be updated using the SaveRecord activity, drag and drop the SaveRecord activity from the related connector activities tool box into the designer.

Select the Target for updating the record (see Inserting Records). All the field values that have been set or mapped to the current record for the selected target will be updated to the data source.

Click on the Option field and Select Update in the Configure Record Save Option Window

You must also select whether to update the record using a PrimaryKey or a CompositeKey. Click on the Unique Key or Composite Key value to do it.

All the field values that have been set or mapped to the current record for the selected target will be updated in the data source.

You can also define optional properties for including more field values to update. click the optional properties button. The following window will be displayed:

Enter the property values as follows:

Upserting Records

The SaveRecord has an option to combine the Insert and Update

At run time, if the record exists, it is updated. If the record does not exist at run time, it is inserted into the target.

Select the Target for upserting the record and Upsert in the Configure Record Save Option

Specify the Insert/Update and the Lookup Settings (value to be tested to check if the record exists or not)

Optional Properties are defined the same way as Insert/Update above

Deleting Records

The DeleteRecord activity is used for deleting records from a target.drag and drop the DeleteRecord activity on to the designer. To delete a record, the record key is required.

At run time, if the record exists, it is deleted.

Select the Target for updating the record. You must also select whether to delete the record using a PrimaryKey or a CompositeKey (RecordKeyType). If you use a composite key, define the fields/values used in the CompositeKey collection.

No Optional properties available for this activity

Last updated