cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
overhead_press2
Frequent Visitor

How to find if textbox value exist in gallery

I have a textbox named "textbox1" and I am wondering how do I check if the text within exists in my gallery text input "galtextinput". What I have tried doing is:

 

 

If ( textbox1.Text in galtextinput.Text, DisplayMode.Disabled,
DisplayMode.Edit)

 

 

 This only seems to work against the first item in my gallery, if I change the value in "textboxl1" to match anything other than the first record in "galtextinput", it doesn't seem to recognize it. How can I modify my code so it can look for matches against all rows in galtextinput.text instead of just the first row? 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @overhead_press2,

Based on the issue that you mentioned, do you want to check if the text within the textbox1 has existed in your Gallery?

Could you please tell me that you want to set the DisplayMode of a Button based on the check result?

I agree with @Ethan_R, you should compare textbox1.Text with the corresponding column value in your data source rather than the galtextinput.Text.

So, please try to set the DisplayMode property of the Button as below:

If(textbox1.Text in DataSource.ColumnName,DisplayMode.Disabled,DisplayMode.Edit) 

Note that how you set the Text property of the galtextinput, if you set it with "ThisItem.Title", then you should replace the DataSource.ColumnName with DataSource.Title.

Check if it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

3 REPLIES 3
Neha
Frequent Visitor

Hi @overhead_press2 ,

Instead of using the name of the text input control that you have in your gallery 'galtextinput.Text' replace it with ThisItem.'column name' (column name as per your data source) in your formula. This should work for all the rows in your gallery. Let me know how it goes.

Thanks,
Neha

Ethan_R
Responsive Resident
Responsive Resident

Hi @overhead_press2 ,

I guess you are trying to filter all records from the gallery that matches to your value in Textbox.

If that's the case, use filter in your items property for Gallery

 

Filter(

dataSource,

IsBlank(textbox1.Text) || textbox1 in columnName

)

 

This will filter Text if it exist in your gallery else show all records.

 

Hope this helps

v-qiaqi-msft
Community Support
Community Support

Hi @overhead_press2,

Based on the issue that you mentioned, do you want to check if the text within the textbox1 has existed in your Gallery?

Could you please tell me that you want to set the DisplayMode of a Button based on the check result?

I agree with @Ethan_R, you should compare textbox1.Text with the corresponding column value in your data source rather than the galtextinput.Text.

So, please try to set the DisplayMode property of the Button as below:

If(textbox1.Text in DataSource.ColumnName,DisplayMode.Disabled,DisplayMode.Edit) 

Note that how you set the Text property of the galtextinput, if you set it with "ThisItem.Title", then you should replace the DataSource.ColumnName with DataSource.Title.

Check if it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (3,323)