How Do I Store a Sequence/Array of Values? (Magic xpi 4.5)
The Operational Data Storage (ODS) system lets you save data so that it can be shared by multiple flow components or flows. In essence, ODS is a quick-access data storage facility that enables many queries on small volumes of data. This differs from a data warehouse, in which large amounts of information are stored and queries are run on a large volume of data.
The Magic xpi ODS system has a data table that holds an entry for each item saved in the ODS. All items saved in the ODS are identified by a flow sequence ID and a UserKey.
You can add arrays of data to an ODS UserKey. Arrays enable the storage of more than one value under the same UserKey. The values in the arrays are called indexes. For example, ODS1_1 is the first index in the ODS1 UserKey.
ODS arrays are used in concurrent processing architecture, where data arrives from many sources and must be processed sequentially later. It is therefore not necessary to assign a unique name for an ODS entry to store data in a multi-threaded environment.
ODS data supports the Alpha, Numeric, Date, Time, Logical, and BLOB data types, and each value in an array can be a different data type. For example, Index 1 in an array can be an Alpha, and Index 2 can be a Numeric.
The Magic xpi ODS system supports these data storage modes:
-
Local Flow Storage (ODS Local). This saves data in the ODS database for a particular flow, for use by parallel steps in the same flow. The data is cleared from the ODS when the Server starts.
-
Global Storage (ODS Global). You can use this mode to save data between flows. All flows can retrieve the data.
You can manually enter ODS data in the ODS repository. The ODS repository maintains all static ODS entry names and their description. It allows you to select an ODS entry to be used when using ODS in the Flow Data utility.
To add an ODS entry to the repository, you should follow these steps:
-
In the Repositories section of the Solution Explorer, double-click on ODS to open the ODS Repository. Alternatively, you can open the ODS Repository by pressing SHIFT+F6.
-
In the ODS Repository dialog box, click Add to create a new entry.
-
Enter the following information in the repository's columns:
-
Name: Enter the name of the ODS data. This is the UserKey.
-
Description: Enter a description that helps to identify the purpose of the data. This is optional.
-
Scope: Select either ODS Global or ODS Local.
-
When you have finished entering the information, click OK to close the repository and save the data.
You can use the Flow Data utility to insert, update, delete, or clear ODS entries. This lets you manipulate ODS data automatically as part of a flow.
-
Drag the Flow Data utility to your flow.
-
Double-click or right-click on the Flow Data utility and select Configuration from the context menu to open the Flow Data Configuration dialog box.
-
In the Flow Data Configuration dialog box, click Add to create a new entry. Use the following guidelines to configure the service:
-
-
Type: ODS Local/ODS Global (see above).
-
Name: Enter the name of your ODS data by selecting it from the Variables list, which lists the variables previously created.
-
Data Type: Set your data type according to your data.
-
Index: When a record is created in the ODS table, the record receives an index number. For example, after three orders have arrived, there will be three records with the same ODS key. The ODS indexes for these records will be 1, 2, and 3. Enter the ODS index that you want to Insert, Update, or Clear. Enter an Index to indicate which index in the ODS Array to Update or Clear, or enter an index to indicate the index number added when you insert new data into the array. This action supports the ODS Global and ODS Local data types.
Note: If you select Clear or Update, and you do not enter an Index, the first Index entry is updated or cleared.
-
-
Update Expression: Enter the data that you want to use to update/insert to the ODS.
-
Condition: This is a free text field. Enter a Boolean expression that indicates under which conditions the target update occurs. True indicates that the update will occur. False indicates that the update will not occur.
Magic xpi provides the following ODS functions:
-
ODSArrayCnt: This function counts the elements in the specified ODS array.
-
ODSExists: This function checks whether an indicated ODS key exists in the ODS database.
-
ODSGet: This function retrieves the value of an indicated ODS entry.