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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA 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

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,446)