Skip to content

Database Scripts¶

Database Script is a core business entity used for creating and managing queries using SQL, Stored Procedures, and DB Lookup operations. It serves as the foundational layer for data retrieval and manipulation within the platform, enabling dynamic, data-driven workflows and business logic.

Imp

It is mandatory to define and create Datasource before working with the entity, Database scripts. Datasource is created in the Management > Configuration Management > Datasource section.

Database script entity is applicable for Process Flows, Data flows, and Event flows.

Viewing Database Scripts¶

The Database Scripts associated with each flow will appear within that flow.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts on the left side panel for viewing the database scripts for the flow module.

    Database script

Creating New Database Script¶

You can create database scripts for the tables in the selected datasource. You can create a database query, database lookup, or procedure as per your requirement.

Prerequisites:

Create the required Datasource in the Management > Configuration Management > Datasource before creating the database script.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts. The database script list appears.

    Creating a new database script

  3. Click +Create New. The Info Actions panel appears as Create Database Script.

  4. Enter the Basic details in the Create Database Script panel as explained below.

    Field Description
    Name* Enter the name of the database script.
    Character limit: 50.
    Data type: Alphanumeric and underscore.
    Scope* The scope of an entity is always local as the entities are created at the flow level.
    Is Datasource Variable Required? If you need a data source variable, select the “Is Datasource Variable Require?” checkbox. Refer to Configuring Datasource Variable.
    Else deselect the checkbox if you don’t require the data source variable.
    Datasource The Datasource dropdown appears if Is Datasource Variable Required? is unchecked.
    Select a datasource from the drop-down. The database script is created for the selected data source.
    Description Enter a description for the database script.
  5. Click More. Configuration details of the database script appear.

    Database script configuration

  6. Select the SQL Type from the dropdown. Based on the SQL type selected, the details are rendered on the page.

    SQL type

    • Query: A Query is a request for data or information from a database table or combination of tables. You can write query strings directly by disabling the Query Builder (uncheck Enable query Builder check box).
    • Procedure: A Procedure is a subprogram that performs a specific action.
    • DB Lookup: DB Lookup reads data from the specified database.
  7. Based on the SQL query type selected, provide a query or procedure below Query String.

    Query String and SQL Editor

  8. Click SQL Editor icon for opening the SQL Editor where you can provide your query details.
    You can drag the Resource Data variable to Query String area for framing the query.

  9. Drag the appropriate variable(s) from the Resource Data to the Output Variable Mapping.
    You can drag multiple variables into the Output variable Mapping based on the number of outputs.
    Refer to Mapping Output Variables for more details.
  10. Click Create after providing the details as needed.
    (or click Cancel to cancel the actions done. When you click cancel, you are navigated to the listing page without saving the modifications.)

Configuring Datasource Variable¶

You can configure a variable for datasource instead of configuring a datasource for the database script entity. The datasource variable receives the input value during the runtime. The purpose of data source variable is to handle the datasource name that is dynamically received during runtime.

For creating a datasource variable follow the below steps.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. In Basic, provide Name and Scope for the database script.
  3. Select “Is Datasource Variable Required?” checkbox. Select Variable list appears.

    Providing Datasource variable details

  4. Click Select Variable drop-down and select the required variable from the Variable list. This variable value is resolved and executed during the runtime.

    Tip

    You can also type the variable name and append the variable name to it. For example, type Data_<$Stock.Id$> in the Select Variable dropdown. Now the first half of the variable name is a constant (ie., Data_ is constant) and the second part of the variable (ie., <$Stock.Id$>) dynamically changes as the value for the variable is resolved during the runtime.

  5. Click More. Database configuration page appears.
    The Query builder that is applicable for the select Query type automatically displays the default datasource tables. You can configure the tables in the default datasource (by enabling Query Builder).
    Refer to Configuring Query (if you want to create a query or write query string based on your requirements for the default datasource.)
    Or
    You can write query strings directly by disabling the Query Builder (uncheck Enable query Builder check box).
    Or
    You can write procedures.
    Refer to Configuring Procedure.
    Or
    configure DBlookup for different datasources (default datasource or other datasources) per your requirement.
    Refer to Configuring DB Lookup.

  6. Configure the output variable mapping as per requirement.
    Refer to Mapping Output Variable.

  7. Provide the required configuration details and click Create.

Configuring Query¶

A Query is a request for data or information from a database table or combination of tables. The available Query Types are Select, Insert, Update and Delete.

You can write query for any BLOB / CLOB / JSON type data when you are referring to different types of databases.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts.
  2. Select SQL Type = Query.

    Configuring SQL Type = Query

  3. Select a Query Type from the drop-down.

    Query Type

    • Insert: Used to insert record(s) to the database based on the script using database activity.
    • Update: Used to update record(s) in the database based on the script using database activity.
    • Select: Used to select and display record(s) based on the script. Selecting the “Select” query type displays the Enable query Builder option.
    • Delete: Used to delete record(s) from the database based on the script.
    • Below the Query String, enter the script. The query should be based on the query type selected.
      Or click the edit icon to open the SQL Editor for writing the required query for the selected query type.

    Match query string with query type

    The Query String should match with the Query Type selected or it will throw an error during the execution.

    Note

    Drag the Resource Data Variables into the Query String or SQL Editor for utilizing the variables needed in the scripts.

    • For Query Type = Insert, enter the SQL query for inserting a record into the database table(s) as per your requirement.

      Example of Insert query type

    • For Query Type = Update, enter the SQL query for updating a record in the database table(s) as per your requirement.

      Example of Update query type

    • For Query Type = Select, enter the SQL query for selecting record(s) from the database table(s) as per your requirement.

    Tip

    For the Select type query, you can enable the query builder for framing the query using the query builder. Refer to Using Query Builder.

    Example of Select query type

    • For Query Type = Delete, enter the SQL query for deleting the record(s) from the database table(s) as per your requirement.

    Example of Delete query type

    SQL Editor for entering SQL queries

  4. If you have entered a query in the SQL Editor, click Save in the SQL Editor for saving and closing the Editor (or click Close to discard the changes in the SQL editor).

  5. On the configuration page, click Create (or Save in Edit mode) after configuring the Query.

Using Query Builder¶

The Query Builder option appears as enabled when you select the Query Type as “Select”.
The query builder helps you to build the query by configuring the tables and adding custom functions to the table attributes. The Query String area below the query builder displays the query that you create using the query builder.

Imp

You are not allowed to edit the details directly through Query String/SQL Editor if you have enabled the query builder. All the details need to be provided through the query builder. For editing directly in the SQL Editor or the Query String, you have to deselect the “Enable query builder”.

Warning

If you deselect the “Enable Query builder, all the details that are created using the query builder get removed. If you select “Enable Query Builder” again, you need to create the query again as all the previous details are removed.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts.
  2. Select SQL Type = Query (selected by default) and Query Type = Select (selected by default).
  3. Select the Enable Query Builder checkbox (by default query builder is checked). The Query Builder appears.

    SQL Query Builder

  4. Provide details as explained below.

    Component Description
    Enable Query Builder? Select Enable Query Builder? checkbox for viewing the query builder.
    Database Tables Lists the tables in the selected datasource that you can use for building queries.
    Query Table design area The tables used for the query are dragged into the query table design area from Database table list.
    - Drag a table from the database table list. The table appears with the list of attributes.
    - Refer to Working with Query Tables for more details.
    Table Search Allows you to filter the tables based on the search text.
    - Click the search icon and enter the search text.
    Rules Allows you to create rules for the table attribute based on criteria.
    - Refer to Adding Rules and Group Rules.
    Table attribute filtering/categorization Based on the categories available you can filter or categorize the table details.
    You can use the Resource Data variables as applicable in the textboxes.
    Group By The GroupBy feature groups the result set by the values in the selected attribute. (E. g., Groupby "Department" where "Department" is an attribute in the table "EmployeeList").
    - Refer to Adding GroupBy Condition.
    Order By The OrderBy feature is used to sort the result set in ascending or descending order based on the selected attribute.
    - Refer to Adding OrderBy Condition.
    Having By The HavingBy feature is used to select the result set based on a condition for the selected attribute.
    - Refer to Adding HavingBy Condition.
    Limit By The LimitBy feature is used to limit the number of records that is to be displayed based on the selected conditions.
    - Refer to Adding LimitBy Condition.
  5. Click Create if you are creating or Save if you are editing a database script for updating the configured details.

Working with Query Tables¶

The Database tables list on the left side of the query builder displays all the tables available in the selected data source.

Note

You can view the query that you are creating in the Query builder below the Query String. As you create a query using the query builder. The queries are updated parallelly in the Query String area as you configure the tables in the Query table design area or select the result set conditions.

Adding Table and Selecting Table Attribute¶

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. Drag a table from the Table list to the query table design area. The table in the query table design area appears with all its attributes. When you drag a table into the query table design area, AND or OR criteria appear below the query table design area.

    SQL query table attributes and rule

  3. In the table that appears in the query table design area, scroll through the attributes and select or deselect the checkboxes as per your selected criteria of the query. (Say, e.g., select “Age”, “ConfirmedDate” from PatientDetails.)

    Patient details

Note

You can add a table only once to the Query table design area. If you add the same table again, an error message appears.

Error

Deleting Table from Query Table Design Area¶

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. Click a table in the query table design area and press DEL for deleting the table.

    Query Builder

Adding Custom Functions for Query Table Attribute¶

You can define custom functions to the table attributes. Custom Functions help you to rename the attribute with an alias name and define a function for the attribute.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. Drag a table from the list of tables to the query table design area. Table attributes are listed with fun adjacent to each attribute on the table.
  3. Select the checkbox in front of the attribute name and then click fun adjacent to the attribute. Custom Functions pop-up appears.

    Custom functions

  4. Enter a name for the attribute in the Alias box. The attribute gets renamed as the Alias name. This Alias name appears in the Query String.

  5. Enter the required function in the Function box (say, Count).

    Note

    You can enter the SQL functions on columns as applicable for the attribute data type in the Function box (E. g., COUNT, AVG, SUM for number data type, COUNT for VarChar, etc.). The function gets executed for the selected attribute (column).

  6. Click Ok.

Defining SQL Joins in Tables¶

You can create JOINS in tables in the Query table design area. A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

The types of Joins supported are INNER, LEFT, RIGHT, FULL.

  • The INNER join selects records that have matching values in both tables.
  • The LEFT join returns all records from the left table (table1), and the matching records from the right table (table2). The result is 0 records from the right side if there is no match.
  • The RIGHT join returns all records from the right table (table2), and the matching records from the left table (table1). The result is 0 records from the left side if there is no match.
  • The FULL OUTER join returns all records when there is a match in the left (table1) or right (table2) table records. FULL OUTER JOIN and FULL JOIN are the same.
  • A SELF-join is a regular join, but the table is joined with itself.

To select an SQL Join:

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure datasource is selected.
  2. Drag the required tables from the list of tables to the query table design area.
  3. Drag from the selected left side table attribute to the selected right side attribute. A link is established and displayed as an arrow from the first table to the second table.

    Creating link

  4. Click the arrow. Join Type pop-up appears for selecting the Join Type.

    Join type

  5. Select a Join Type from the dropdown as per your requirement. If you do not select a join type, it is selected as INNER join by default.

  6. On the Join Type pop-up, click Ok (or click Cancel to discard the action). A link with the selected Join type is established between the tables.

    • Click the link for viewing the Join Type defined for the tables.
    • Click the link and then click Delete in the Join Type pop-up for deleting the link/join.

Adding Rules and Group Rules¶

You can add rule(s) for the selected records. You can use AND / OR criteria or group the rules as per your requirement.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. Add a table into the query table design area. The AND / OR rule grid appears. The table below gives a brief description of the UI elements that are part of the rule grid.

    SQL Query Rule builder

    Field Description
    AND / OR This is applicable when you add multiple rules using the +Add Rule.
    You can add a AND or OR criteria for multiple rules. Default is AND criteria.
    Add Rule Allows you to add multiple rules. You should add AND or OR criteria for multiple rules.
    Add Group Allows you to add multiple groups.
    Move Rule When there are multiple rules, up and down, you can click the move symbol and drag up or down for rearranging the order of the rules.
    Validation error The validation error symbol appears if your rule is incomplete or if there is an error in the rule defined. Hover over for viewing the error details.
    Select Filter Allows you to select the required attribute for which you want to apply the rule.
    Condition Rule conditions can be selected from the drop-down. Rule conditions appear based on the data type of the selected attribute.
    Value Value for the selected attribute.
    Delete Allows you to delete the rule/group as applicable
  3. In the Select Filter, select the attribute from the list.

  4. Select the condition for the rule.

    condition

  5. When you select a certain condition(s) (say, e.g, not equal to) Select Function field appears. The select Function feature applies only to applicable conditions.

    Select Function

  6. Select a function from the list as per your requirement.

  7. Enter the value in the Value textbox on the right side of the Function field.

    Or select the column checkbox. Select Filter appears for selecting another column as the value.

    Select Filter

    Or select the Variable checkbox and drag a variable into the value textbox. The variable checkbox appears only for the primary key attribute.

    Variable checkbox

  8. For adding multiple rules, click Add Rule (new rule grid appears), click AND or OR criteria and then define a new rule.

  9. Click Add Group and then click the Add Rule within that group for adding multiple rules within that group.

    SQL Query - Adding and Grouping rules

    • Click the delete icon adjacent to a rule for deleting that rule.
    • Click the delete icon adjacent to Add Group for deleting the group.
    • Click the up/down arrows (in front of the rule) and drag for moving the rules.
    • The validation error indication appears as a red triangle warning in front of the rule. Hover over the warning symbol and the error appears as a tooltip.

Adding GroupBy Condition¶

The GroupBy feature groups the selected records by the selected attribute. (E.g., Groupby "Department" where "Department" is an attribute in the table "EmployeeList".)

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. In the Table query area, drag the tables and define the selection criteria as per requirement.
  3. Click Add under Group By for adding a group by criteria.

    Configuring Group By

  4. Select the Attribute Name by which the grouping is to be done.

  5. Click Add again for adding more criteria.
  6. Below Action, click the delete icon for deleting the corresponding condition in the GroupBy.

Adding OrderBy Condition¶

The OrderBy feature is used to sort the result set in ascending or descending order based on the selected attribute.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. In the Table query area, drag the tables and define the selection criteria as per requirement.
  3. Click Add under Order By for adding an order by criteria.

    Configuring Order By

  4. Select the Attribute Name for which the ordering is to be done.

  5. Below Order, select the order in which sorting is to be done (Ascending or Descending order).
  6. Click Add again for adding ordering for another column.
  7. Below Action, click the delete icon for deleting the corresponding condition in the OrderBy.

Adding HavingBy Condition¶

The HavingBy feature is used to display records based on a condition. A Having clause in SQL specifies that an SQL Select statement must only return rows where aggregate values meet the specified condition.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. In the Table query area, drag the tables and define the selection criteria as per requirement.
  3. Click Add under Having By for adding a having by criteria.

    Configuring Having By

  4. Select the Attribute Name, Function, Condition, and Value by which the having by is to be done.

  5. Click Add again for adding more HavingBy criteria.
  6. Below Action, click the delete icon for deleting the corresponding condition in the HavingBy.

Adding LimitBy Condition¶

The LimitBy feature is used to limit the number of records that is to be displayed. That is, only the first limit by value number of records that satisfy the conditions are captured as output.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts. Make sure Datasource is selected.
  2. In the Table query area, drag the tables and define the selection criteria as per requirement.
  3. Click Add under Limit By for adding a limit by condition.

    Configuring Limit By

  4. Provide the Limit Value by which the limiting is to be done for the records. You can add only one LimitBy condition.

  5. Below Action, click the delete icon for deleting the corresponding condition in the LimitBy.

Configuring Procedure¶

A Procedure is a subprogram that performs a specific action. You can call a procedure using the database script entity.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts.
  2. Select SQL Type = Procedure.

    Configuring SQL Procedure

  3. Below the Query String, enter the procedure name and the parameters to call the procedure.
    or click the edit icon to open the SQL Editor for writing the required procedure.

    Example

    For example, Call ProcedureName();. If more than one parameter is used, then comma-separated values are used (parameterA,ParameterB);. The parameters are not mandatory and are dependent on the procedure called.

    Tip

    The procedure to be used in the Query String field must be created in the selected database. You can call an existing procedure to execute it in the database.

    SQL Editor

  4. After entering the query in the SQL Editor, click Save in the SQL Editor (or click Close to discard the changes).

    Drag the appropriate variable from the Resource Data to the Output Variable Mapping. Refer to Mapping Output Variable for more details.

  5. Click Create.

Configuring DB Lookup¶

DB Lookup reads data from the specified database.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts.
  2. Select SQL Type = DB Lookup.

    Configuring DB Lookup

  3. Below the Query String, enter the DB Lookup query.
    or click the edit icon to open the SQL Editor for writing the DB Lookup query.

    SQL Editor

  4. After entering the query in the SQL Editor, click Save in the SQL Editor (or click Close to discard the changes).
    Drag the appropriate variable from the Resource Data to the Output Variable Mapping. Refer to Mapping Output Variable for more details.

  5. Click Create.

Mapping Output Variables¶

It is mandatory to map an output variable when you select Query Type as Select. The output variable stores the output data for each “select” criteria defined for the table(s).
The output of each “select” criterion is stored in the output variable in the order of appearance below the Output Variable Mapping section. That is, the output of the first select criteria output is stored in the first output variable (as appears in the Output Variable Mapping). The output of the second select criteria is stored in the second output variable and so on.
You should add an output variable as applicable or as needed as per the requirement in the output mapping.
If there are two “select” criteria and three output variables, only the first two output variables are utilized and the third one gets ignored.

  1. Navigate to the business entity, Database Scripts > More for displaying configuration details on database scripts.
  2. Drag the matching data type variable created for the output of select criteria from the Resource Data to the Output Variable Mapping. The variable data type should match the data type of the “select” criteria.

    Configuring Output Variable Mapping

  3. Map output variable for each “select” criterion in a similar way.

  4. Drag the variables added below the Output Variable Mapping for rearranging the order of appearance. You can use the collection variable also in the output variable mapping.

    Output Variable Mapping

Deleting Output Variable Mapping¶

  1. Select the checkbox in front of the output variable. Select multiple checkboxes if you want to delete multiple variables or select the checkbox in the output mapping header for selecting all output variables. The delete button appears at the bottom of the Output Mapping.

    Delete Output Variable Mapping

  2. Click Delete. The selected variables are deleted.

Mapping Index Variable to Output Variable Mapping¶

An index variable is used to store an array of values.
If you map an index variable to a “select” criteria for which the output value is single, the value gets stored in the zeroth index of the index variable. If you store an array of data in a normal output variable, the first result value is stored in the output variable. If you store an array of output data in an index variable, all the output values are stored in the indexed output variable.

  1. Drag an index variable from the Resource Data to the Output Variable Mapping section.
    The index variables appear with index [0] amended to the variable name. The edit index icon appears on the right side of the variable.

    index variables

  2. Click the edit icon. Edit Entity Index Value popup appears. You can edit the index of the variable. If you want to consider this variable as a normal variable (not a collection variable, you can remove the index – [0].

  3. Click Ok.

Viewing and Editing Database Scripts¶

Make sure to unlock the application before editing if you want to edit the details of an entity that is not created by you.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts. The database script list appears.
  3. Click the Database Script card for viewing the details of the selected database script. The details of the database script appear in the Info Actions panel.
  4. Click More for viewing the configuration details of the database script.

    Viewing and Editing database script details

  5. Edit the database script details as needed.

  6. Click Save.

Viewing database Script Associations¶

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts. The database script list appears.
  3. Hover over any database script card. Three dots appear on the upper right side of the card.
  4. Click the three dots. More Actions appear.

    Viewing associations

  5. Click Associations. The association of the database script with the application, flow modules and activities are displayed in a pop-up.

    Database script associations

    • Application – The application in which the database script is utilized.
    • Flow - The flow in which the database script is utilized.
    • Activity/Entity - The activity or entity name in which the database script is utilized.
    • Type - The type of activity or entity.

Duplicating Database Script¶

Make sure to unlock the application before duplicating an entity that is not created by you. When you duplicate a participant, the associations are not duplicated.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts.
  3. Click a database script. The database script list appears.
  4. Hover over any database script card. Three dots appear on the upper right side of the card.
  5. Click the three dots. More Actions appear.

    Duplicating database script

  6. Click Duplicate. A confirmation pop-up appears.

    Duplicate confirmation

  7. Click Ok for duplicating the database script (or you can click Cancel to cancel the duplicate action). A Success message appears on the successful duplication of the database script.

    Duplicate success message

  8. Click Ok. A duplicate copy of the database script appears on the Database Script page with the same name suffixed with “_copied”.

    The duplicated database script

Deleting Database Script¶

Make sure to unlock the application before deleting a Database Script that is not created by you. Also, you cannot delete the Database Script if it is associated with any activity or Database Script.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts. The database script list appears.
  3. Click the database script name card that is to be deleted. The lower-right of the page displays Delete.

    Deleting database script

  4. Click Delete. A Confirmation pop-up for delete appears.

    Database Script Delete confirmation

  5. Click Ok for deleting the database script.
    Or
    Click Cancel to cancel the action.

Alternatively, you can follow the below steps to delete the database script:

  1. Click the Burger menu and navigate to App Studio > Application > {Flow module} > Database Scripts.
  2. Hover over the database script card. Three dots appear on the upper right side of the card.
  3. Click the three dots. More Actions appear.
  4. Click Delete and follow step 6 in the above procedure.

    Delete action in More Actions

Utilizing Database Script Entity¶

Mapping Database Script in Activity¶

You can map the database script to the activity, DB in the process flows. When the process flow is executed and encounters the DB activity, the database script associated with the DB activity is executed. The database script contains the query or procedure mapped to a data source table. That is, the DB activity points to a database table with a query or procedure required for the input data.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.

    Info

    Open or create a process flow with DB activity in the flow.

  2. Click the DB activity and the Info Actions panel displays the configuration and properties.

  3. Click Database accordion. Database Script mapping details appear.

    Database mapping for the DB activity

  4. Click Use Transaction checkbox if you want to roll back the actions (scripts executed) in case there is an error in any of the multiple scripts mapped to the DB.
    Else uncheck Use Transaction.

  5. Below the Default Database script, select a default database script from the drop-down. The drop-down lists all the database scripts. Only one database script can be added as a default database script.
  6. Click Add More. Conditional Database Script details appear for adding conditional database scripts based on the rules.

    Adding conditional database scripts based on rules

  7. Under Conditional Database Script, Select a database script.

  8. Click Rule and select a rule for the selected conditional database script.
  9. Click Add More again for adding more conditional database scripts. You can add multiple conditional database scripts based on different rules.

    Note

    During runtime, if a rule is satisfied, the Database Script mapped for that rule appears for the user in the interface. If none of the rules are satisfied, the default Database Script appears as an interface.

Accessing Database Scripts in Form Lookup¶

You can create Database scripts (with SQL Type = DB Lookup) in the business entity section and utilize the Database script for getting look-up details of the entity through Form UI.

To create a lookup of the data entity table (in runtime Form) through the database script, you need to create the required database script in the business entity section.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts and create the required database script with SQL Type = DB Lookup. Refer to Configuring DB Lookup.
  3. Click Forms.
  4. Double-click and open a form.
  5. Drag a Lookup component from the Component list. Lookup Component pop-up appears.

    Lookup Component pop-up

  6. In the Lookup component pop-up, click the LookUp tab.

    Selecting Data Base as a data source type

  7. In the LookUp tab, click Select Data Source Type and select Data Base as datasource. Details based on the data source type= Database appear.

    Configuration details for the Database in the lookup

  8. Select the required database script name from the Database Scripts drop-down and configure other details.

    Info

    When you map a database script to the lookup control in the form, during the runtime, it fetches the records from the selected data source table and renders them on the form by executing the database script.

Accessing Database Script in Variable Lookup¶

You can map a database script to a variable through DB Lookup if you want to define a database query for the variable. When the flow initiates, the DB Lookup executes and assigns the result set to the variable to which you mapped the script.

  1. Navigate to App Studio > Applications - open application name > Process Flow / Data Flow - flow name > Open.
  2. Click Database Scripts and create the required database script with SQL Type = DB Lookup.
    Refer to Configuring DB Lookup.
  3. Click Variables.
  4. Double-click and open any variable except the variable of data type = Document. DB lookup is applicable for all the data types except the “Document” type.

    DB Lookup configuration for the variable

  5. Select the DB Lookup checkbox and select a database script. Now the database script is mapped to the variable through the DB Lookup.

Note

When the corresponding process flow initiates, the database lookup executes and the result set of the execution is stored in the variable.