cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dlprentice
Resolver II
Resolver II

How to match a string against one or more values in an array?

Lets say I have a string like this:

 

BLMBORNX-R1LULU-N887518E002 (or even a partial string like BLMBORNX-R1LULU-)

 

I want to match this up with values in an array. However in the array there could be more than one match (which is ok)

 

Lets say the closest match is this:

 

  {
    "City""HONOLULU",
    "State""HI",
    "Network ID""blmbornx-r1lulu-bdosoooo22"
  },
  {
    "City""HONOLULU",
    "State""HI",
    "Network ID""blmbornx-r1lulu-Ndo9f-3iu0920jf"
  },
 
My desired output would be:
 
Most likely locations based on BLMBORNX-R1LULU-N887518E002:
 
CityStateNetwork ID
HONOLULUHIblmbornx-r1lulu-bdosoooo22
HONOLULUHIblmbornx-r1lulu-Ndo9f-3iu0920jf

 

This is what I got so far:

Screenshot 2021-01-29 082820.png

 

JSON Format of array:

{
    "type""array",
    "items": {
        "type""object",
        "properties": {
            "City": {
                "type""string"
            },
            "State": {
                "type""string"
            },
            "Network ID": {
                "type""string"
            }
        },
        "required": [
            "City",
            "State",
            "Network ID"
        ]
    }
}
1 ACCEPTED SOLUTION

Accepted Solutions
ManishJain
Solution Sage
Solution Sage

Hi @dlprentice ,

 

You can use Filter array action to filter out the array with your filter you want. eg. for your case the input will be the array you are looking to filter and in the filter condition 

 

item()?['network id'] is equal to 'string comparison'

 

this will give you array as an output if matched else empty array which you can use further to create CSV table or HTML table.

 

Thanks

View solution in original post

1 REPLY 1
ManishJain
Solution Sage
Solution Sage

Hi @dlprentice ,

 

You can use Filter array action to filter out the array with your filter you want. eg. for your case the input will be the array you are looking to filter and in the filter condition 

 

item()?['network id'] is equal to 'string comparison'

 

this will give you array as an output if matched else empty array which you can use further to create CSV table or HTML table.

 

Thanks

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Top Solution Authors
Users online (1,193)