cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Text box content match with data source

 

Hi,

I have a data source "Region". Which contains some 5 regions like Asia, Europe and so on.. I need user to enter only one of those 5 regions in a text box. If user enter some new region then that particular text box should throw error. Is it possible? I also tried changing text box to drop down and linked to data source and that works fine but I need user to enter details in text box.

 

Thanks..

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff murali
Power Apps Staff

Re: Text box content match with data source

Hello Gopi - 

 

Just so I understand the question. You need a way of somehow notifying the user when the provided input is invalid, the mentioned approach should work. 

 

1. If(IsBlank(LookUp(DS, 'First Name' = TextInput1.Text)), "Valid", "Invalid") means if the given input matched what exists in the datasource then it's valid, otherwise it is invalid.

2. This assumes there is a column named 'First Name' in the datasource. Are you sure it does?

3. What errors are you seeing?

4. What is your current locale?

 

Knowing answers to the above will help us guide you better.

 

Thanks

Murali

View solution in original post

9 REPLIES 9
LarsDP
Level 8

Re: Text box content match with data source

Is there a datacard connected to the region field? If so you can put a textinputfield in that datacard with this function in your errortext:

 

If(Upper(TextInput.Text) = "Europe" || "Asia" || "Africa" || "America"; ""; "There was a mistake in your input")

 

and outputDelayed on your textinput set to true

Anonymous
Not applicable

Re: Text box content match with data source

It is not possible to mention the region names (Just example) in function as there can be more than 1000 rows. In that case what should I do?

LarsDP
Level 8

Re: Text box content match with data source

You could make a table in excel with the regions in a list, named Regions with 'RegionName' as header of the table and add this table as static data.

Then you could put this in the error:

 

If(IsBlank(LookUp(Regions;TextInput.Text = RegionName)); "There is a fault in your input."; "")

 

This will take the text of the input and compare it to the table with all of the regions. If there is a match, it won't display a text, if there is no match, the text will be shown. 

Anonymous
Not applicable

Re: Text box content match with data source

Kindly find below pic and help me with it.. I need to type something manualy in the text input in case if that key word doesn't match with beside table record then I should get error message. 

 

Sorry in the pic I just wrote some text info with my mouse. I know which is not good.. 😞

 

Capture.PNG

LarsDP
Level 8

Re: Text box content match with data source

So the following does not work?

 

If(IsBlank(LookUp('[dbo].Employee_Record]';TextInput2.Text = Firstname)); "There is a fault in your input."; "")

 

I have not worked with sql in powerapps before but I would assume you are referring to the wrong field in Firstname. The column name should be written without quotation marks (again, I'm not sure about this, try to see if it wants to autocomplete to the fieldname). But this only works if what you write is exactly how it's stored in your table. For example if you were to search 'stephanie' it would give an error because it would have to be 'Stephanie' in order for it to work

 

 

Edit:

You can try

If(IsBlank(LookUp('[dbo].Employee_Record]';TextInput2.Text = Title)); "There is a fault in your input."; "")

 

 

Anonymous
Not applicable

Re: Text box content match with data source

Sorry! ;-( tried all the three functions..Still doesn't work! 

 

Capture.PNGCapture1.PNGCapture2.PNG

LarsDP
Level 8

Re: Text box content match with data source

Try using semicolons ';' instead of commas ','

I believe they changed that a few weeks ago

Anonymous
Not applicable

Re: Text box content match with data source

tried ;-(

 

Capture.PNG

Power Apps Staff murali
Power Apps Staff

Re: Text box content match with data source

Hello Gopi - 

 

Just so I understand the question. You need a way of somehow notifying the user when the provided input is invalid, the mentioned approach should work. 

 

1. If(IsBlank(LookUp(DS, 'First Name' = TextInput1.Text)), "Valid", "Invalid") means if the given input matched what exists in the datasource then it's valid, otherwise it is invalid.

2. This assumes there is a column named 'First Name' in the datasource. Are you sure it does?

3. What errors are you seeing?

4. What is your current locale?

 

Knowing answers to the above will help us guide you better.

 

Thanks

Murali

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,455)