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

Search and extract key value pair from array

Hi   I have a flow with an array and I would like to extract and split the key-value pairs when the entered acronym matches. 

 

So for example, if I enter "TTO"  

 

I would like to split     "TTO___________Training Time Off""TTO" into 

    "TTO___________Training Time Off" and "TTO" so they can be used separetely in a SharePoint list.

 

my array is as follows:

 

[
  {
    "FML____________Familiy Medical Leave""FML"
  },
  {
    "PL___________Personal Leave""PL"
  },
  {
    "TTO___________Training Time Off""TTO"
  },
  {
    "VCTO______Vacation Time Off""VCTO"
  },
  {
    "ANNUAL____________Anual Leave""Annual"
  }
]
 
 
array.jpg
1 ACCEPTED SOLUTION

Accepted Solutions

It would work if you filtered it, but perhaps this is more like exactly what you want:

https://ibb.co/3k4bC1z 

 

I changed the LeaveType array like this:

 

[
  {
    "Key": "FML____________Familiy Medical Leave",
    "Value": "FML"
  },
  {
    "Key": "PL___________Personal Leave",
    "Value": "PL"
  },
  {
    "Key": "TTO___________Training Time Off",
    "Value": "TTO"
  },
  {
    "Key": "VCTO______Vacation Time Off",
    "Value": "VCTO"
  },
  {
    "Key": "ANNUAL____________Anual Leave",
    "Value": "Annual"
  }
]

 

and the flow looks like this:

 

 

Filter.png

 

Compose action gives you exactly what you are after. But obviously you will need to put dynamic content into the filter section to suit your need.

View solution in original post

4 REPLIES 4
Memorable Member
Memorable Member

I don't think I completely understand, but something like this?

 

json-key-value.PNG

@Paulie78  Thank you for the reply. 

I'm not sure that will work because any other value could be entered. 

What I'm looking to do is to match the key and the value. and I think the solution might involve an expression, I'm just at a loss on how to write it.  Maybe the way the array is written isn't good.

 

To give another example based on the array, if I enter "VCTO" 

 

my compose expression should give me an output of "VCTO______Vacation Time Off"

 

It would work if you filtered it, but perhaps this is more like exactly what you want:

https://ibb.co/3k4bC1z 

 

I changed the LeaveType array like this:

 

[
  {
    "Key": "FML____________Familiy Medical Leave",
    "Value": "FML"
  },
  {
    "Key": "PL___________Personal Leave",
    "Value": "PL"
  },
  {
    "Key": "TTO___________Training Time Off",
    "Value": "TTO"
  },
  {
    "Key": "VCTO______Vacation Time Off",
    "Value": "VCTO"
  },
  {
    "Key": "ANNUAL____________Anual Leave",
    "Value": "Annual"
  }
]

 

and the flow looks like this:

 

 

Filter.png

 

Compose action gives you exactly what you are after. But obviously you will need to put dynamic content into the filter section to suit your need.

View solution in original post

@Paulie78  that works great. exactly what I needed. thank you so much for taking the time!!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (8,177)