cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Extracting Value from Specific Column in SharePoint Custom List Based on Internal Name as Variable

Hello,

 

I have a Variable Array that contains the column names ("Tracker Columns").  Its format is:

 

[
{
"Column Name": "AIO Approval (S)",
"Internal Name": "AIO_x0020_Approval_x0020_Status"
},
{
"Column Name": "Approval Queue (S)",
"Internal Name": "Approval_x0020_Queue_x0020_Statu"
},
{
"Column Name": "BOM Ready (S)",
"Internal Name": "BOM_x0020_Ready_x0020_Status"
}, .....

 

This Variable Array contains a subset of names found in the SharePoint Custom List - "Tracker."

 

My goal is to use "Apply to each" to traverse the "Tracker columns," ideally setting a string variable - "New Status Value" - when for the desired columns only.  I have tried using - triggerBody()?variables('Current Internal Name')?['Value'] - whereby the italisized portion of the statement would be variable.  However, when I try to save I get "Expression is invalid."  Note: Current Internal Name has the format - ["AIO_x0020_Approval_x0020_Status"].  (I am unsure how to use concat to create a single quote versus the ones showing.  Thus, I could use a clue.)

 

Is there a way to feed a variable into a statement as per the example above?  If so, how?

 

All ideas, insight, and help is very much appreciated.

 

Cheers.

4 REPLIES 4
v-litu-msft
Community Support
Community Support

Hi @Anonymous,

 

Please take the value from Specific column as below, use the item() to get current item of array, and then use "?" to get element and put the column name in the [''].Annotation 2019-10-23 113209.png

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

Anonymous
Not applicable

Thank you for your insight.

 

Following your advice I am able to construct a clean statement:

 

triggerBody Compose.PNG

 

However, using the statement in a subsequent action to derive the value of the target list simply returns the same text:

 

triggerBody Compose 2.PNG

 

The hopes were to obtain the value from the triggering list, column AIO_x0020_Approval_x0020_Status.

 

What might I be missing?

 

Cheers.

Anonymous
Not applicable

I've spent the better part of another day trying to achieve the goal of 'body' and 'triggerBody' construction based on internal names fed from another Variable Array.  No success!  (The goal is to use only the names within the Tracker Columns array, not all names available within 'body' or 'triggerBody.')  Here's a broader view:

 

Loop.PNG

 

Note that the Condition is always true currently because comparison values evaluate to nulls.  Here are the two statements:

 

triggerBody()?[concat('''',variables('Tracker Columns')[variables('Loop Count')]?['Internal Name'],'''')]
body('Get_items_-_Tracker_Last_Status')?[concat('''',variables('Last Status Columns')[variables('Loop Count')]?['Internal Name'],'''')]
 
Any additional clues or am I just not going to be able to use third-element variables to achieve my mission?
 
As alway, all insight is welcomed and appreciated.
 
Cheers.
 
 
Anonymous
Not applicable

Update:

 

Using this statement:

 

concat('body(','''','Get_items_-_Tracker_Last_Status','''',')?[','''',string(variables('Last Status Columns')[variables('Loop Count')]?['Internal Name']),'''',']?[','''','Value','''',']')

 

I am able to form the desired output:

 

body('Get_items_-_Tracker_Last_Status')?['AIO_x0020_Approval_x0020__x0028_']?['Value']  (example)

 

But, obviously I simply get a string and not an executed statement.

 

Any idea how to turn this into an executed statement?

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,096)