Skip to main content

Notifications

Community site session details

Community site session details

Session Id : rAcAeEblsZCrPIdIIS+3J/
Power Apps - Building Power Apps
Answered

Validate input text is exists in the table

Like (0) ShareShare
ReportReport
Posted on 23 Sep 2019 04:37:10 by 52

Hi.. how can i check the input text is exists in the table.. I have tried lookup function in the onchange but its not working.. if its not exists i want to show validation like not exist too.. can anybody help?

  • neethup Profile Picture
    52 on 24 Sep 2019 at 09:01:49
    Re: Validate input text is exists in the table

    @v-xida-msft Hi thank you for your time.. I have tried this also but not working

  • v-xida-msft Profile Picture
    on 24 Sep 2019 at 08:43:25
    Re: Validate input text is exists in the table

    Hi @neethup ,

    Could you please share a bit more about the ClientID column in your SQL Table? Is it a Number type column or Text type column?

     

    Currently, I could not reproduce your issue on my side.

    If the ClientID is a Number column in your SQL Table, please consider modify your formula as below:

    If(
     IsBlank(LookUp('[dbo].[CUSTOM_cmClient]', ClientID = Value(DcClientID.Text))), /* <-- If the ClientID is a Number type column in your SQL Table */
     Set(ShowErrorMsg, false),
     Set(ShowErrorMsg, true)
    )

    In addition, I also think a Timer control could achieve your needs. Add a Timer control in your app, set the Duration property to following:

    1000

    Set the AutoStart property and Repeat property to following:

    true

    Set the OnTimerEnd property to following:

    If(
     IsBlank(LookUp('[dbo].[CUSTOM_cmClient]', ClientID = Value(DcClientID.Text))), /* <-- If the ClientID is a Number type column in your SQL Table */
     Set(ShowErrorMsg, false),
     Set(ShowErrorMsg, true)
    )

    Set the Visible property of the Timer control to following:

    false /* <-- Hidden the Timer control */

     

    Set the Visible property of the Error Message Label to following:

    ShowErrorMsg

    Best regards,

  • neethup Profile Picture
    52 on 24 Sep 2019 at 05:41:12
    Re: Validate input text is exists in the table

     

    @v-xida-msft form2.png

  • neethup Profile Picture
    52 on 24 Sep 2019 at 05:39:29
    Re: Validate input text is exists in the table

    formula.pngformula1.png

  • v-xida-msft Profile Picture
    on 24 Sep 2019 at 05:22:35
    Re: Validate input text is exists in the table

    Hi @neethup ,

    Could you please share a bit more about your formula?

    Could you please share a screenshot about it?

     

    Please note that the OnChange property of the Text Input box would be fired only when you move the mouse focus from the Text Input box to other place in your app.

     

    Currently, I could not reproduce your issue on my side, please check if you have typed proper formula within your app. Also please consider re-create a new app, then try above solution again.

     

    Note: Please make sure the Network is in good condition on your side.

     

    Best regards,

  • neethup Profile Picture
    52 on 24 Sep 2019 at 05:02:08
    Re: Validate input text is exists in the table

    @v-xida-msft  Hi., i have tried this but nothing is getting worked.. not even showing error message

  • neethup Profile Picture
    52 on 24 Sep 2019 at 04:18:15
    Re: Validate input text is exists in the table

    @v-xida-msft  Thank you so much.. I will try this

  • Verified answer
    v-xida-msft Profile Picture
    on 24 Sep 2019 at 02:07:08
    Re: Validate input text is exists in the table

    Hi @neethup ,

    Do you want to check if the entered Text value existed in your data source already?

    Could you please share a bit more about the LookUp formula in your app?

     

    Based on the needs that you mentioned, I think the OnChange property of the Text Box and the LookUp function could achieve your needs.

     

    I have made a test on my side, please take a try with the following workaround:1.JPG

     

    2.JPG

    Set the OnChange property of the Text Input box (TextInput1) to following:

    If(
     IsBlank(LookUp('20190701_case7', Title=TextInput1.Text)),
     Set(ShowErrorMsg, false),
     Set(ShowErrorMsg, true)
    )

    On your side, you may need to type the following:

    If(
     IsBlank(LookUp('YourDataSource', FilteredColumn = TextInput1.Text)), /* <-- FilteredColumn represents the column in your data source, which you want to compare with the Text Input value */
     Set(ShowErrorMsg, false),
     Set(ShowErrorMsg, true)
    )

    Add a Error Message Label under above Text Input box, set the Text property to a error message you want to display. e.g.

    "The value you typed has been existed, please re-type a new one!"

    set the Visible property of the Label to following:

    If(ShowErrorMsg, true, false)

    Please check the following GIF screenshot for more details:Test.gif

     

    Best regards,

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 23 Sep 2019 at 15:15:04
    Re: Validate input text is exists in the table

    Hi @neethup 

    Put a label field on the screen.  Set it's Text property to IsEmpty(Search(table,TextInput1.Text,"Column1","Column2",etc).  In order to search a table, you need to define which columns of data need to be searched.   The Textbox will return false if the text in the textinput control is found in one of the columns you are searching.  If the text is not found, it will return true. 

  • neethup Profile Picture
    52 on 23 Sep 2019 at 10:14:44
    Re: Validate input text is exists in the table

    @Drrickryp  I dont want to filter datatable.. i have a textbox field if i input something it should check the input text is exist in the table or not

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,751 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard