Get Data from a Database

To get one record from a database with SQL statements or stored procedures, do the procedure in this topic.

Figure: Query Record > SQL Command tab

SQL Command tab
Figure: Query Record > Variable and Query screen

Variable and Query screen
Figure: Query Record > Stored Procedure tab

Stored Procedure tab

Examples

Good to Know

  • In most text fields, you can use process data variables as an alternative to literal data values.
  • You can configure whether this activity waits for other activities before it runs.

    For more information, refer to How Do I Configure an Activity to Wait for Other Incoming Activities?

  • Some information about third-party integrations is outside the scope of the AgilePoint NX Product Documentation, and it is the responsibility of the vendors who create and maintain these technologies to provide this information. This includes specific business uses cases and examples; explanations for third-party concepts; details about the data models and input and output data formats for third-party technologies; and various types of IDs, URL patterns, connection string formats, and other technical information that is specific to the third-party technologies. For more information, refer to Where Can I Find Information and Examples for Third-Party Integrations?

How to Start

  1. On the Application Explorer screen, do one of these:
  2. Do one of these:
    • Add an activity:
      1. In the Process Builder, go to the Activity Library, and open the Database Database icon tab.
      2. On the Database Database icon tab, drag the Query Record Query Record icon activity onto your process.
    • Change an activity:
      1. In your process, double-click your activity.
  3. Click Query Record Query Record icon.

Procedure

  1. Complete the fields on the General Configuration screen.

    For more information, refer to Configure General Options for a Database activity..

  2. To get the data from the database, do one of these.
    • To get the data with a SQL Command, do this procedure:
      1. On the Query Record screen, in the Database list, select your database access token.

        To create a new access token, click Add Token Add Token icon. For more information, refer to Access Token for Database.

      2. (Optional) In the Schema Name list, select a schema associated with the specified database.
      3. In the Attribute Name and Queries field, click Add Add icon.
      4. On the Variable and Query screen, in the Attribute Name field, enter the name of the variable to store your data.
      5. In the Data Type list, select the data type of your attribute.
      6. (Optional) If you want to include the synonyms in the Table Name list that is created in the database, select Include Synonyms in the list Include Synonyms in the list icon.
      7. (Optional) If you want to include the views in the Table Name list that is created in the database, select Include Views in the list Include Views in the list icon.
      8. In the Table Name list, select the name of your database table, synonyms, or view.

        When you select the table name, synonyms, or view, the Column Name shows the name of the column.

      9. (Optional) In the Sql Select Query field, enter a SQL SELECT query to get your data.

        You can drag the column names from the Column Name field to create your SQL SELECT query.

    • To get data from the database with a stored procedure, do this procedure:
      1. On the Query Record screen, click the Stored Procedure tab.
      2. On the Stored Procedure tab, in the Database list, select your database access token.

        To create a new access token, click Add Token Add Token icon. For more information, refer to Access Token for Database.

      3. In the Stored Procedure Name list, select your stored procedure.
      4. In the Value/Attr. Name field, enter the value of the stored procedure parameter, or drag a process data variable from the Process Data screen.
      5. To specify the input and output options for the stored procedure, complete this field as necessary.
        Field Name Definition

        in/out.

        Function:
        Specifies the in/out parameters for the stored procedure.
        Accepted Values:
        • Input - Specifies that the parameter is an input value for the stored procedure.
        • Output - Specifies that the parameter is an output value for the stored procedure.
        • InputOutput - Specifies that the parameter can be input/output value for the stored procedure.
        • ReturnValue - Specifies that the parameter is a return value for the stored procedure.
        Default Value:
        None
        Accepts Process Data Variables:
        No
      6. In the Data Type list, select the data type of the stored procedure parameter.
      7. In the Size field, enter the size of the input parameter for the stored procedure.