cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sarath_123
Helper I
Helper I

Compare two values in label

Hi Team,

Happy New Year all!
I have an Attachment Box (DataCardValue) where I can browse and attach files, I have a Drop down which has country names, The files to be attached will have the country name in their suffix eg: (Data_Spain.Xlsx), I need to check if the Dropdown selected value matches the name in the file attachment.

For this I have created 2 label - fetching the Filename from attachment and displaying in 1 label and fetching the dropdown selected value and displaying in another label.


tpp.JPG

 

Now I need to compare these 2 Label and check if the country name is present in the Filename to be attached. If matches allow user to upload if not matches say not to upload.

 

I tried ISMATCH funtion but no help.

Any other possibilities ?Thanks-Sarath

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Super User II
Super User II

@sarath_123 

Set DisplayMode property of a button to:

If (Label2.Text in Label1.Text, DisplayMode.Edit, DisplayMode.Disabled)

 

In this way you can be sure that the user cannot use the button if your condition isn't met.

 

Additionally you can put a label with something similar in Text property.

If (Label2.Text in Label1.Text, "","Upload blocked ! Check the filename or select a different country !")

View solution in original post

4 REPLIES 4
JesperHuang
Helper I
Helper I

Hi @sarath_123 ,

 

Did you modify "Match options" in IsMatch function?

Default is "Complete", in your scenario should use "Contains", hope this help!

 

IsMatch( your_file_name, "Spain", Contains )

 

gabibalaban
Super User II
Super User II

@sarath_123 

Set DisplayMode property of a button to:

If (Label2.Text in Label1.Text, DisplayMode.Edit, DisplayMode.Disabled)

 

In this way you can be sure that the user cannot use the button if your condition isn't met.

 

Additionally you can put a label with something similar in Text property.

If (Label2.Text in Label1.Text, "","Upload blocked ! Check the filename or select a different country !")

View solution in original post

Thank you ! 
Here "Spain" will not be a constant value always.

It will get dynamic from the Country Dropdown.

Thanks-Sarath 

sarath_123
Helper I
Helper I

If (Label2.Text in Label1.Text, DisplayMode.Edit, DisplayMode.Disabled)

This worked - Thank you 

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.

Users online (2,250)