Alternate Access Pattern For Table Integrations
  • 26 Feb 2020
  • 5 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Alternate Access Pattern For Table Integrations

  • Dark
    Light

Article summary

Overview

Alternate Access Pattern can be used to speed up data retrieval by allowing more customized procedures. This is like using an index, where it points to data in a table. This is very useful for databases with massive amounts of data.
This tutorial demonstrates how to use the Alternate Access Pattern for a database table. Alternate Access Pattern generates a step that can be used in the workflow to retrieve information from the integrated table based on input fields that are defined at the time of Alternate Access creation.

Note
  1. Go through the following document to avoid SQL Server Database Permissions errors: SQL Server Database Permissions

  2. The following link will guide you through the same functionality by writing a SQL Query: Parameterized Queries

  3.  Users can use their default Decisions database or can integrate with another database. For more information on integrating a database, see Integrating an External Database with a Flow

Example

In this example, users will add a table to the database, create an Alternate Access to the Table, and test Alternate Access Pattern in the Flow.

Note

The example below uses the Local Decisions Database. Users can use any database they have integrated with to add Alternate Access Patterns.

Adding Database Table

Navigate to the System > Integrations > Databases > Local Connection (This should be the database the user is using).
Then, click 'Add Table' on the Folder Actions Panel.

2020-01-28_13h58_44.png

Alternative

In any designer folder navigate to Datatypes/Integrations > Database Integration > Add Table.

2020-01-28_14h02_36.png

In the Add Table pop-up window pick available table from the Table Name dropdown list.
For this example, add in the "Entity_Account table.

2020-01-28_14h18_19.png

Pick Table Fields that will be available for this integration, Table Keys, and Steps to be generated by the System for working with this table. Click 'Ok' to save the integration.

2020-01-28_14h18_33.png

2020-01-28_14h19_21.png

Add Access Pattern

Navigate to System > Integrations > Databases > [Database Name] > [Table Name]. Select the Table Integration and select Manage Additional Access action.

2020-01-28_14h20_03.png

In the resulting folder, click Add Access Pattern button on Folder Actions Panel.

2020-01-28_14h25_53.png

In the Add Access Pattern configuration window, Name the Access Definition and pick what Fields should be Inputs for the step that will be generated by the System. Click 'Ok' to save and continue. For this example, choose the "Company" for the Field.

2020-01-28_15h26_39.png

The Additional Access Pattern is created. The step that was generated in this case will work as a query for the Accounts table that should pull all Accounts where Account. Company equals Input to the step. Close the folder.

2020-01-28_15h28_57.png

Using the New steps in a Flow

Navigate to a Designer Folder and click Create Flow from the Folder Actions Panel. In the resulting pop-up window Name the Flow and click Create to proceed to the Flow Designer.

2020-01-28_14h31_42.png

In the Flow Designer, add Show Form step from Steps category. This Form will serve to grab the user’s input.
In the resulting window Name the Form and click 'Create' to proceed to the Form Designer.

2020-01-28_14h33_00.png

In the Form Designer simply add Label, Textbox, and Button to the workspace.
For this example, this Form asks the user to input "Company" and submit to display results on the next Form. Save the Form and close Form Designer.

2020-01-28_14h37_39.png


Any place that "AccessUserAccountByCompany" is used, users should replace that with their step they created if using a different table.

Add the Created Step

In the Flow Designer, add the Step that was created through the Access Pattern. For this example,
AccessUserAccountByCompany step was used in this Flow that was generated by the Additional Access Pattern from the Integrations > My Integrations > Database > Local Connection category.

2020-01-28_14h39_05.png

On the Done outcome from the AccessUserAccountByCompany step add another Show Form step from the Steps tab. This Form should be designed to display the result of the AccessUserAccountByCompany step. Name the Form and click 'Create' to proceed to the Form Designer.

2020-01-28_15h39_54.png

In the Form Designer, add a Button to the Form. Next, add a Data Grid component from the List category. In the Input Data section enter the Data Name, then using the Type picker pick LOCALCONNECTION_dboentity_account type from the Table Definition Types.

2020-01-28_14h41_58.png

Data Grid creates Columns that will represent fields in our Table. Users can change their order or remove any of them to prevent them from displaying them on the Data Grid component. This completes the second Form design. Save the Form and close Form Designer.

2020-01-28_14h42_55.png

Back in the Flow Designer add Show Popup step from the Steps Tab category on the Failed outcome from the AccessUserAccountByCompany step. This pop-up will alert the user in the case if the AccessUserAccountByCompany step fails for some reason (like failed connection).

2020-01-28_15h43_29.png

Next, configure the Subject and Message for the Pop-up step and click 'Add'.

2020-01-28_14h49_02.png

Then, connect the steps in the Flow. When all steps in the Flow are connected, select AccessUserAccountByCompany step on the workspace to configure it.

2017-01-06_150909.png

Locate the input configuration. For the Company input, the Select Value Mapping type is used and Entered Company Name data from the Textbox on the First Form is picked.

2020-01-28_15h48_07.png

Select the Second Form step on the workspace and locate Inputs configuration. In this example, for AccountsByCompanyGrid element on the Form Select Value Mapping type was used and Accounts For Company_Result output from the AccessUserAccountByCompany step was picked.

2020-01-28_15h50_44.png

Testing

Note
Before testing, Users must have created accounts and added in the company information to test this example. For more information go to Adding User Account.

This completes the Flow Design. Save and Close the Flow. Run the Flow to test it out.

2020-01-28_15h52_24.png

The first Form opens in the user enters Company in the text box and clicks Show Accounts. in this example,  the user searched the company "Test Company". 



The second Form opens with all Accounts for the company "Test Company" displayed. Click 'Done'.



Get By ID & Get All Steps

When a table is added, it creates a list of steps that can be used with it. The example below added the database table "dbo.entity_account". It also creates a step "Fetch by email address" by using the Alternate Pattern Access. The main difference between these steps is the inputs and the flexibility with the configuration. The output of these steps is the same: "dboentity_account_Results", "Error Details", "Error Message".


2020-01-27_16h01_45.png

Get By ID Step

This step only requires the input of a single "Account ID". It will display all data relating to any accounts found with that ID.

2020-01-27_16h32_24.png

Get All Step

This step only requires the input "Limit Count". This value will limit the number of results that are displayed. This step will get all the data in the table. In this case all the accounts and their information.

2020-01-27_16h31_39.png

Access Pattern step: Fetch by Email Step

This step provides more flexibility compared to the other two. The number of inputs can be varied for this step. In the example, this step has three inputs: "Email Address", "Modified date", and "Never expires". Each of these steps is paired with the "Match type" input.
Match Type constant values are:

  • Equals
  • DoesNotEquals
  • IsNotEqual
  • IsNull
  • GreaterThanOrEqualTo
  • LessThanor EqualTo
  • GreaterThan
  • LessThan

2020-01-27_16h29_33.png

This step will have a more restrict/narrow search and outcome. This would be an ideal method for tables with a large amount of data.



Was this article helpful?