LogoLogo
HomeCommunityLangstack.comCreate free account
  • 🤝Welcome
  • 🙌Support
  • 💡Get started
    • 📕Learn Langstack
      • Introduction to Langstack
        • Application templates
        • Storage frameworks
        • Account administration
      • Basics and essentials
        • What is an API gateway?
        • How to work with an API gateway
        • What is an Entity?
        • What is an Action box?
          • How to create and work with Action boxes
          • How to perform search in Actions
        • What is an Action?
          • How to create and work with Actions
          • Error propagation
          • Actions in Langstack applications
        • What is a Data type?
          • Simple Data types
        • What is a Variable?
          • Naming rules of a Variable
        • What is a Function?
          • Working with Functions
        • Navigating to a Variable or a Function
        • Implicit Type Conversion (ITC)
        • Explicit Type Conversion
        • Implicit and Explicit Type Conversion for Json
        • Next Steps
      • User management
        • What is a Privilege?
        • What are Groups?
        • What are Users?
      • Introduction to REST API
        • API Name
        • API Group name
        • Request and Response body
          • Request body
          • How to create and work with a Request body
          • Response body
          • How to create and work with a Response body
        • Query strings
          • How to create and work with Query strings
        • Headers
          • How to create and work with Headers
        • Path parameter
        • Create your first API: "Hello World!"
          • Working with API options
        • Exercise 1: GET REST API & Return Response Object
          • Step 1: Create API
          • Step 2: Test the API
        • Exercise 2: Delete a published API
        • Next Steps
      • Introduction to Entities
        • Fields
        • Records
        • Relations
        • Options for an Entity
        • Exercise 1: Customer Accounts and Activities
          • Customer accounts
            • Step 1: Create the Customers Entity
            • Step 2: Create the API
            • Step 3: Update entity through API
          • Customer Activities
            • Step 1: Create the Activities entity
            • Step 2: Create a “1 to Many” relation
            • Step 3: Create the API
            • Step 4: Update entity through API
        • Exercise 2: Customer Records
          • Step 1: Create the API
          • Step 2: Test the API
        • Next Steps
      • Programming with Entities
        • Create
        • Read
        • Update
        • Delete
        • JXPResponse
        • Next Steps
      • Using Triggers
        • After Create Trigger
        • After Update Trigger
        • After Delete Trigger
        • Exercise: Entity & Entity triggers
        • Step 1: Define “After Create” Trigger
        • Step 2: Define “After Update” Trigger
      • Connectors
        • Create a connector
        • SFTP Connector
        • MySQL Connector
        • Next Steps
      • Introduction to ETL pipeline
        • Create an ETL pipeline
        • Data Formats in ETL pipeline
          • Reader
          • Writer
          • Field mapping
        • Shared variables for ETL pipeline
        • ETL functions execution sequences overview
        • Displaying Functions
        • How to perform Search in ETL pipeline
        • Exercise 1: Skip Customer records
          • Step 1: Create the ETL pipeline
          • Step 2: Skip records based on Customer_ID
          • Step 3: Store skipped records in a list
          • Step 4: Store the Skipped Customer record
        • Exercise 2: ETL pipeline, CSV source & FTP Connector
        • Exercise 3: ETL pipeline, Database Source & MySQL Connector
        • Exercise 4: ETL pipeline, CSV Source & FTP Connector using Sections
          • Step 1: Create the ETL pipeline
          • Step 2: Reformat the Join_Date Values and define added fields
      • Multiple Executions, Time Duration, Linked App and Execution Status
        • Skip execution while in progress
        • Time duration settings
        • Linked App
        • Options for Delay Types
        • Execution status
      • Validation pipeline
        • Sequence of Validation pipeline
        • Exercise: Customer Information
          • Step 1: Create a Validation pipeline
          • Step 2: Create the API gateway
          • Step 3: Test the Validation pipeline
      • Introduction to Process
        • Create a process
        • Shared variables for a process
        • Exercise: Customer Anniversary Email Activity
          • Step 1: Check if the join date matches the current date
          • Step 2: Test the Process
      • Introduction to Flows & Flow components
        • What is a Flow?
        • What is a Flow component?
          • What is a Flow component Event?
        • Exercise 1: Customer Anniversary Email
          • Step 1: Create the Flow component
          • Step 2: Create the Flow
          • Step 3: Trigger the Flow
          • Step 4: Check records in the target entity
        • Exercise 2: Store list of customers
          • Step 1: Create the Flow component
          • Step 2: Create the Flow
          • Step 3: Create the API
    • 🌍Tour of Langstack (coming soon)
  • 📘In depth learning
    • 📖User Manual (coming soon)
    • 🔗Connectors
      • MS-SQL connector
        • Data type conversions between Langstack and MSSQL
        • Handling data loss in data type conversions
        • Setting up MS-SQL connector
        • MS-SQL connector as Reader and Writer
        • Using MS-SQL connector in ETL pipeline
          • MS-SQL connector as a source
          • MS-SQL connector as a destination
      • Google Drive connector
        • Set up Google Drive Connector
        • Adding Google Drive path in ETL pipeline Streams
        • Setting up GCP Account, GCP Project, API Enablement, and Credentials (Prerequisites)
          • OAuth 2.0 Client Credentials
          • Service Account Key Credentials
          • API Key Credentials
          • Authorization through Redirect URLs
        • Using Google Drive connector in ETL pipeline
          • Specifying file or folder paths
            • Direct file link
            • Folder link and file name
            • Folder path and file name
            • Folder path excluding file name
            • Folder path including file name
          • Google Drive connector as a source
          • Google Drive connector as a destination
      • AWS connector
        • Introduction
        • Set up AWS S3 Connector
          • OAuth 2.0 Client Type
          • Access Key
          • Public
        • Setting up AWS Account
          • Retrieve Client ID and Client Secret
        • Set up Amazon Web Services (Cognito) Console
          • Retrieve Identity Pool Id
          • Manage Permissions for Roles
          • Adding Redirect URL in Amazon Developer Console
          • User Consent for OAuth 2.0 Client through Login with Amazon
          • Retrieve Access Key Credentials
        • Creating a bucket in AWS
        • Using S3 connector in ETL pipeline
          • Specifying paths
          • Examples
            • AWS S3 connector as a source
            • AWS S3 connector as a destination
      • OneDrive connector
        • Set up OneDrive Connector
        • Setting up Microsoft Azure Account
        • Add URL to Authorized Redirect URLs
        • User Consent for Establishing OneDrive Connection
        • Usage of OneDrive Connector in ETL pipeline
          • Examples
          • OneDrive connector as a source
          • OneDrive connector as a destination
      • Dropbox connector
        • Set up Dropbox Connector
        • Setting up Dropbox Account
        • Add URL to Authorized Redirect URLs
        • User Consent for Establishing Dropbox Connection
        • Usage of Dropbox connector in ETL pipeline
          • Dropbox connector path settings
          • Examples
            • Dropbox connector as a source
            • Dropbox connector as destination
  • 🗃️Use Cases (Coming soon)
    • Use Case 1
    • Use Case 2
    • Use Case 3
Powered by GitBook
On this page
  1. Get started
  2. Learn Langstack
  3. Validation pipeline
  4. Exercise: Customer Information

Step 1: Create a Validation pipeline

PreviousExercise: Customer InformationNextStep 2: Create the API gateway

Last updated 2 years ago

Create a Validation pipeline named “UserName_Acc_customers_validation” and define it as follows:

  • To go to the Validation pipeline, on the left side panel, click “Validation pipeline” under the “Data management” menu.

  • To create a new validation, click on the [+ Validation pipeline] button.

  • The Details tab is selected by default. To define the Validation pipeline:

    1. Enter Validation Name as “UserName_Acc_customers_validation”.

    2. Optionally enter a description for this Validation pipeline.

    3. To define a target entity for this Validation pipeline, select the target entity from the drop-down menu as “UserName_Acc_customers”.

  • To create a new Step, go to the Code tab and expand the Validation steps function.

  • To create a new step, click on the [+ Step] button.

  • A new Step is created with the label “Description”.

  • To give the Step a more meaningful name, click the text “Description” and rename it to “check for mandatory fields”. This Step is defined to check that the values for the mandatory fields: First Name, Last Name, Email, and Phone are entered.

  • To add Criteria bars in the step, click the (+) button. Add four (4) Criteria bars.

  • To check if the value of the “First_Name” field is not set, define the first Criteria bar as follows:

    1. Select Source as Variables>Source_UserName_Acc_customers>First_Name. It is displayed as “Source_UserName_Acc_customers.First_Name”.

    2. Select Operator as “Is Not Set”.

  • To check if the value of the “Last_Name” field is not set, define the second Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Last_Name. It is displayed as “Source_UserName_Acc_customers.Last_Name”.

    2. Select Operator as “Is Not Set”.

  • When two Criteria bars are defined, they are grouped together by the AND operator. To add a third Criteria bar to the AND group, ensure to click the (+) immediately below the second Criteria bar.

  • To check if the value of the “Email” field is not set, define the third Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Email. It is displayed as “Source_UserName_Acc_customers.Email”.

    2. Select Operator as “Is Not Set”.

  • To check if the value of the “Phone” field is not set, define the fourth Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Phone. It is displayed as “Source_UserName_Acc_customers.Phone”.

    2. Select Operator as “Is Not Set”.

  • To check if the values entered are just empty strings, add four (4) more Criteria bars.

  • To check if the value of the “First_Name” field is empty, define the fifth Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>First_Name. It is displayed as “Source_UserName_Acc_customers.First_Name”.

    2. Select Operator as “Is Empty”.

  • To check if the value of the “Last_Name” field is empty, define the sixth Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Last_Name. It is displayed as “Source_UserName_Acc_customers.Last_Name”.

    2. Select Operator as “Is Empty”.

  • To check if the value of the “Email” field is empty, define the seventh Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Email . It is displayed as “Source_UserName_Acc_customers.Email”.

    2. Select Operator as “Is Empty”.

  • To check if the value of the “Phone” field is empty, define the eighth Criteria bar:

    1. Select Source as Variables>Source_UserName_Acc_customers>Phone. It is displayed as “Source_UserName_Acc_customers.Phone”.

    2. Select Operator as “Is Empty”.

  • Finally click on the logical operator “AND” to make it “OR”. This means if any of these Criteria bars are not valid or empty, proceed to the actions.

  • To define Actions, go to the Code tab>On True section of Step 1. Add four (4) Actions by clicking the (+) button. If the criteria is validated to True, a sequence of actions in the “On True” section will be executed. In this case, the error response will be returned if the criteria is valid and any of the fields is not present or contains empty strings. Here, the details of the response are configured in case of “On True”.

  • To define the first Action to update the errorcode in the Response as “400”:

    1. Select Action as “Update Variable”.

    2. Select Target variable as Response>errorcode. It displays as “Response.errorcode”.

    3. In the Value, type the number as “400” and press Enter.

  • To define the second action to update the message in the “Response”:

    1. Select Action as “Update Variable”.

    2. Select Target variable as Response>message. It displays as “Response.message”.

    3. In the Value, type the text as “Complete mandatory fields: First Name, Last Name, Email and Phone.” and press enter.

  • To define the third action to update the status of the “Response”:

    1. Select Action as “Update Variable”.

    2. Select the Target variable as Response>status. It displays as “Response.status”.

    3. In the Value, type the text as “Missing mandatory field(s)” and press Enter.

  • Add the last Action in the section as “Exit Validation” that exits with the value “false”. Based on the value of True or False, the On Validation step success or On Validation step fail function in the Validation>Code tab is executed.

    1. Select Action as “Exit Validation”.

    2. In the “Exit With” field, type “false” and press Enter.

  • To check if the phone number is valid, add Step 2 and label it as “check if phone number is valid”. This Step will verify if the phone number entered is numeric and the length is between 7 and 10 digits.

  • To verify the phone number data type, minimum length and maximum length, add three (3) Criteria bars by clicking the (+) button in the “Criteria” tab.

  • To verify if the phone number is of numeric value, define the first Criteria bar as follows:

    1. Select Source as Source_UserName_Acc_customers>Phone>isNumeric(). It is displayed as “Source_UserName_Acc_customers.Phone.isNumeric()”.

    2. Select Operator as “Is Equal”.

    3. Enter the Value as “true”.

  • To verify if the phone number length is less than or equal to 10, define the second Criteria bar as follows:

    1. Select Source as Source_UserName_Acc_customers>Phone>length(). It is displayed as “Source_UserName_Acc_customers.Phone.length()”. This measures the length of the strings entered into the field.

    2. Select Operator as “Less Than Equal to”.

    3. Enter the Integer value as “10”.

  • To verify if the phone number length is greater than 7, define the third Criteria bar as follows:

    1. Select Source as Source_UserName_Acc_customers>Phone>length(). It is displayed as “Source_UserName_Acc_customers.Phone.length()”. This measures the length of the strings entered into the field.

    2. Select Operator as “Greater Than”.

    3. Enter the Integer value as “7”.

  • Keep AND as the logical operator. This means all of the Criteria bars must return true before executing the Code tab>On True section. If any of the Criteria bars does not return true, the Code tab>On False section Actions will be executed. The Criteria tab should be as per the image below.

  • To define the actions if the Criteria returns true, go to the Code tab>On True section of “Step 2” to define the sequence of actions. Add an Action by clicking the (+) button.

  • To exit validation if the Criteria returns true, define the action as follows:

    1. Select Action as “Exit Validation”.

    2. In the “Exit With” field, type “true” and press Enter. Based on the value of the Exit Validation as true, the Validation>Code tab>On Validation step success section is executed followed by the execution of the “On Exit” section. If no Action in the On Validation step success section of Validation>Code tab is configured, only the “On Exit” section is executed.

  • To define the response details in case invalid customer phone data is encountered, go to the Code tab>On False section. Add three (3) Actions by clicking the (+) button.

  • To define the response message, define the first action to update the message in the Response.

    1. Select Action as “Update Variable”.

    2. Select Target Variable as Response>message. It displays as “Response.message”.

    3. In the Value, type the text as “Phone number provided is invalid.” and press Enter.

  • To define the response status, define the second action to update the status of the “Response” as “invalid data” .

    1. Select Action as “Update Variable”.

    2. Select Target Variable as Response>status. It displays as “Response.status”.

    3. In the Value, type the text as “invalid data” and press Enter.

  • To define the response error code, define the third action to update the errorcode in the “Response” as “401”.

    1. Select Action as “Update Variable”.

    2. Select Target Variable as Response>errorcode. It displays as “Response.errorcode”.

    3. In the Value, type the number as “401” and press Enter.

  • Add the last action in the section to define “Exit Validation” action as “false”. Based on the “false” value, the “On Validation step fail” section of the Validation>Code tab is executed.

    1. Select Action as “Exit Validation”.

    2. In the Exit With field, type “false” and press Enter.

  • To save the Validation pipeline, click the [Save] button.

  • To publish the Validation pipeline, click the [Publish] button.

💡
📕