Overview

Your appRules projects may require reading data from files, data bases, SAAS applications and other sources.  appConnector activity modules include activities for initializing Sources for reading data.  For example, the appConnector SQL Server module features the InitializeMssqlSource and InitializeMssqlSourceFromQuery activities.   Once initialized, you can use the GetNextMssqlRecord activity to read the next record from the result set in the Source.

InitializeSource Activity

The appRules InitializeSource activity is used for initializing the Source.  For example, to read data from Microsoft SQL Server, you will need to initialize the Source of the data, select the connector to use and define filters for specifying the records to read.  At design time, you can also get a count and view the records defined by the Source that you have defined.

                                     image166.jpg

  For example, to define the Source for reading SQL Server data source, drag the InitializeSource activity from the SQL Server module activities on to the designer and configure the properties as follows:

                            image167.jpg


 

  Property   Description
Connector Select the connector to be used in this Source for reading SQL Server records.
image168.jpg
Follow the on-screen instructions to select the Connector Type, Connection Option and other values.  
PrimaryEntity Select the primary SQL Server table from the list.    
RecordCount Displays a count of the records that meet the criteria defined by the FilterItems property.
If no filter is defined, the count of the total number of records in the table is displayed.
This is a design time feature that gives you the number of records in the list.    
Records Displays a list of the records that meet the criteria defined by the FilterItems property.
If no filter is defined, browsing starts at the first record in the list.
This is a design time property for viewing table records before running your project.  
RecordsAndFields    
RelatedEntities Use this property to include related tables in the result  
AutoLoad This property is defaulted to FirstRecord which loads the first record from the list of records that meet the filter criteria.  Other options include AllRecords which allows you to utilize preloaded records for tables with a small number of records.   AllRecords option is especially useful if you will be performing a lot of lookups from the table.  
AutoRecordCount Whether to automatically count the number of records.  
DataFields Select the data fields to be returned from SQL Server.  If no data fields are specified, all fields are returned.      
FilterItems You can optionally use this property to define the criteria for selecting the entity records to be included in the result set.  
SortItems You can optionally use this property to define how the records in the Source are to be sorted.  


InitializeSourceFromQuery Activity

 

In addition to the standard Source initialization activity defined in the previous section, you can also optionally use a query to define the Source to be used for reading records if the appRules module includes the InitializeSourceFromQuery activity.

For example, to use a query to read data from SQL Server, use the InitializeSourceFromQuery activity from the SqlServer toolbox:

  For example, to define the Source for reading SQL Server data source, drag the appropriate InitializeSourceFromQuery activity on to the designer and configure the properties as follows:

image169.jpg 


 

                     

 

  Property   Description  
Datasource Select the Datasource to be used In this Source for reading SQL Server records.
image170.jpg
Follow the on-screen instructions to select the Connector Type, Connection Option and other values.  
Query Enter the query for selecting the records using the query editor:
image171.jpg      
AutoLoad This property is defaulted to FirstRecord which loads the first record from the list of records that meet the criteria.
Other options include AllRecords which allows you to utilize preloaded records for entities with a small number of records.
AllRecords option is especially useful with you will be performing a lot of lookups from the entity.  
VirtualFields This property allows to define non existing datafields that will store the values loaded by the query (for example a Max or Sum value)

 

 

 


 

 

GetNextRecord Activity

 

To read the next record from an open connection in appRules, you use the GetNextRecord activity from the appropriate activity module.    For example, to read the next record from a SQL Server data source, drag and drop the GetNextRecord activity on to the designer.  The only property required is the Source (An InitializeSource activity defined previously in the project). 

 

 

                                       image172.jpg

 

 

                            image173.jpg

appRules includes activities for looking up data from data sources.  Lookups provide a convenient means of reading a specific record from the data source.  You can also use the Lookup activities to verify existence of a record in the data source.

LookupRecord Activity

 

The LookupRecord activity returns a specific record from a data source.  It uses the same properties as the as the InitializeSource activity discussed in the previous chapter.             

LookupPreloadedRecord Activity

 

The appConnector InitializeSource activities can be configured to load records into memory.  If an activity module supports preloading of records, a record can be loaded from the list by using a LookupPreloadedRecord activity.