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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (47,774)