cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DougMyers
Level: Powered On

Need to Extract Value from Variable Array by Key in Pair

Hello,

 

My challenge is to obtain the numeric value that has been paired with a string key name stored in a Variable Array named T Factors (e.g. ["Readiness,3"]).  The final goal is to insert that numeric value into a numeric column for a single Sharepoint list item.

 

Perhaps I'm trying to overthink this or simplify this too much, but after a day of attempts, I'm lost.

 

Any help provided would be greatly appreciated.

 

Thank you,

 

Doug

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Need to Extract Value from Variable Array by Key in Pair

Hi @DougMyers 

 

Array - ["Readiness,3"]

Use expressions

 

int(variables('varname')?[1])  - this will give you the number 3

variables('varname')?[0] - this will give you the string Readiness

 

varname - name of your variable

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

 

 

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: Need to Extract Value from Variable Array by Key in Pair

Hi @DougMyers 

 

Array - ["Readiness,3"]

Use expressions

 

int(variables('varname')?[1])  - this will give you the number 3

variables('varname')?[0] - this will give you the string Readiness

 

varname - name of your variable

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

 

 

View solution in original post

DougMyers
Level: Powered On

Re: Need to Extract Value from Variable Array by Key in Pair

Thank you for the insight.

 

I tried the basic one and cannot get it to work.  Here are a few ways I tried (placing in a text column for now):

 

variables('T Factor'?[1]) (This is pointing the the Variable Array.)
variables('Readiness'?[1])
 
I get "The expression is invalid." when I try to save it.
 
Note:
 
There are 27 items in the array T Factor.   Here's how I build the Variable Array key-value pair:
 
MSFLOW.PNG
 
Any further advice?
 
Cheers.
DougMyers
Level: Powered On

Re: Need to Extract Value from Variable Array by Key in Pair

Correction:

 

variables('T Factor')?[1] obtains the 2nd pair within the array but does not allow for obtaining a specific key OR value.
Community Support Team
Community Support Team

Re: Need to Extract Value from Variable Array by Key in Pair

Hi @DougMyers ,

 

Have your problem be solved?  If yes, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best Regards,

Alice

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,454)