How to validate user input with MS SQL Table ?

Hi Community,

I have a user input task on my site. User fills the data and the data goes into MS SQL table.

I have a field (say PR No.) in my form. I want to validate the the data entered by user in the PR filed on the fly with my table to check whether PR No. entered by user exist in my table or not ?

How can i do it ?

 

Thanks for your help.

  Discussion posts and replies are publicly visible

Parents
  • Hi prup
    first you have to write query entity to fetch table data and then a!queryentity().data.PR No hear you wil get list of {PN No}
    then by using contains() function you can search the entered PR NO

    example:

    load(
    Local!PRNoList: a!queryEntity().data.PRNO,
    a!sectionLayout(
    label :"",
    contents: a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!textField(
    label: "PR NO",
    value: ri!PRNO,
    saveInto: ri!PRNO,
    validations: if(
    contains(
    local!PRNoList,
    ri!prNo
    ),
    "PR No Exists",
    {}
    )
    )
    }
    )
    }
    )
    )
    )

Reply
  • Hi prup
    first you have to write query entity to fetch table data and then a!queryentity().data.PR No hear you wil get list of {PN No}
    then by using contains() function you can search the entered PR NO

    example:

    load(
    Local!PRNoList: a!queryEntity().data.PRNO,
    a!sectionLayout(
    label :"",
    contents: a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!textField(
    label: "PR NO",
    value: ri!PRNO,
    saveInto: ri!PRNO,
    validations: if(
    contains(
    local!PRNoList,
    ri!prNo
    ),
    "PR No Exists",
    {}
    )
    )
    }
    )
    }
    )
    )
    )

Children