web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / using isMatch() with t...
Power Apps
Unanswered

using isMatch() with thisItem.xyz on collections

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

A very similarly worded subject title has been posted elsewhere, but unfortunately it didn't solve my issue.

 

I am trying to show different images on a cascading menu based on whether the item (parent/child/subchild) has children items.

 

If there are no children items, the image shown should be Blue_Circle.

 

Currently, the logical test I am trying to use do determine whether Blue_Circle appears is based on the ID number of the items. Eg:

 

Item 1 is a parent of 1.1 and 1.2. Item 1.2 is a parent of 1.2.1 and 1.2.2.

Item 2 is a parent of 2.1 and 2.2

Item 3 has no children.

Item 4 is a parent of 4.1 and 4.2. Item 4.1 is a parent of 4.1.1 and 4.1.2.

 

The logical test is as follows:

1) Check whether the item's ID number is contained whether any other ID numbers.

2) Count the total number of matches.

3) If the total in 2) is 1, then display the blue dot.

 

This does not work and I'm consequently not sure how to use isMatch() within a collection! I keep getting the error "The function "isMatch()" has some invalid arguments" with no elaboration on what's wrong.

 

I believe that isMatch() requires a text value to compare against, but using the text() function to enclose thisitem.ID_number does not solve the issue.

 

Here's the code:

 

If(
 CountA(ForAll(Col_Media_AirportData1,IsMatch(ID_Number,ThisItem.ID_Number,Contains)))=1,

 Blue_Circle,
 If(
 ThisItem.Expanded,
 Blue_Triangle_Expanded,
 Blue_Triangle_Collapsed
 )
)

 

Categories:
I have the same question (0)
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Are you sure that you use collection to save these data?

    I've made a test and found that if you save number in collection, two decimal number can not be seen as a value (for example 4.1.1).

    It will be seen as a text by default.

    And also, if you transfer this to value, this will not work.

     

     

    Here's my test that may help you:

    1)my collection

    ClearCollect(test,{ID_Number:"1"},{ID_Number:"1.1"},{ID_Number:"1.2"},{ID_Number:"2"},{ID_Number:"2.3"},{ID_Number:"3"},{ID_Number:"4"},{ID_Number:"4.3"})

    2)Set the gallery's Items:

    AddColumns(test,"number",Text(Value(ID_Number),"[$-en-US]#"))

    Set the label's Text inside the gallery:

    If(CountRows(Filter(AddColumns(test,"number",Text(Value(ID_Number),"[$-en-US]#")),ThisItem.ID_Number in number))=1||
    CountRows(Filter(AddColumns(test,"number",Text(Value(ID_Number),"[$-en-US]#")),ThisItem.ID_Number in number))=0,
    "no chirden","have chirden")

    Then, the items that have chirden will be marked as "have chirden", others will be marked as "no chirden".

     

    By the way, in this situation, I suggest you not use IsMatch function.

    The syntax of IsMatch function is :

    IsMatch( Text, Pattern [, Options ] )

    Pattern must be a constant formula without any variables, data sources, or other dynamic references that change as the app runs.

    "ThisItem.ID_Number" is not a constant formula without any variables.

     

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-yutliu-msft , thanks for the reply. I'm now using tests that avoid isMatch(). So far, based on your assistance, I have been able to solve part of the issue; details further on. I have also switched from periods to commas to avoid issues with periods, so 1.4 becomes 1,4 and 1.4.2 becomes 1,4,2.

     

    Based on your advice, I put together the following test.

     

    If(
     CountRows(Filter(Col_Media_AirportData1,ThisItem.ID_Number in ID_Number))=1,
    
     Blue_Circle,

    This test checks if the ID number of the current item is contained within any other ID number, and if there is only 1 match, then it gets a blue circle image.

     

    But this test is too narrow. Sometimes there are ID numbers that DO contain the ID number. For example:

     

    1.4.2 happens to contain 4.2, even though they are not related to each other. I believe this means that the above test would return 2 items, not 1, for the item 4.2, so 4.2 would be considered a parent-but it has no children!

     

    I have tried to devise a second test. This would check that, if more than 1 match is found for the test above, that only the longest of the matching strings is noted. Here's an example:

     

    1.4.2 happens to contain 4.2

    But of these 2 strings, 1.4.2 is the longest.

     

    Therefore, 1.4.2 is an 'ultimate child' and gets a blue circle.

     

    So how do I add a condition that checks that the item's length is the longest of any strings contained within the items above?

     

    Alternately, is there a way to check if a string is unique  within a column?

     

    Thanks for the help so far-assistance with the above would be very useful.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard