Reading Data
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 activity. Once initialized, you can use the GetNextMssqlRecord activity to read the next record from the result set in the Source.
NB: The BaseData module features the common activities, for all the connectors available. (InitializeSouce, IntializeTarget, GetNextRecord, SaveRecord...). The dedicated connector module can have additional specific activities (Ex: ExecuteStoredProcedure in Microsoft SQL Server).
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 datasource and entity (table) 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.
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:
Type the sql query to load the data, you can mix data from several tables (using SQL statement with JOIN or WHERE CLAUSE).
Use the Tables and DataFields button to select the correct names from the datasource definitions.
ViewQuery, viewrecords and viewcount buttons to test your query
See samples section of the documentation for learning more about the use of customquery
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).
Looking up Data
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.
Last updated