Salesforce

How Do I Store a Sequence/Array of Values? (Magic xpi 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Store a Sequence/Array of Values? (Magic xpi 3.x)

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.

Implementation

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 service.

Adding an ODS Entry to the Repository

To add an ODS entry to the repository, you should follow these steps:

  1. From the Project menu, click ODS to open the ODS Repository.

  2. In the ODS Repository dialog box, click New to create a new entry.

  3. 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.

  4. When you have finished entering the information, click OK to close the repository and save the data.

Managing Data in ODS Entries

You can use the Flow Data service to insert, update, delete, or clear ODS entries. This lets you manipulate ODS data automatically as part of a flow.

  1. Drag the Flow Data service to your flow.

  2. In the Flow Data Configuration dialog box, click New to create a new entry. Use the following guidelines to configure the service:

    • Action: You can choose one of the following actions:

      • Update replaces data or adds data to a variable. For example, you can add the contents of a file to a UserBLOB or UserString. You can also change the value of a flow variable.

      • Insert adds data to an ODS Key Index. An Index is part of an ODS Array, which allows you to enter more multiple data in a single ODS key. The individual data entries for the array are contained in an index. When you select Insert, the Index field is disabled. It is generated automatically as the next Index number when the ODS record is created.

      • Delete erases an ODS entry. This erases the data at the UserKey level, and that UserKey no longer exists.
        Note: Be aware that when you select Delete, all the data in the ODS will be deleted.

      • Clear removes internal values from a specified ODS UserKey. However, the UserKey remains and you can add or change the data at any time.

      • Reset changes the value of a flow variable to the original default value entered when creating the value. This option is used only if you entered a default value when creating the flow variable.

  • 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.

ODS Functions

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.

Reference
Attachment 
Attachment