cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
curthulbert
Frequent Visitor

Issues with parsing data

The error is:

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each_3')?['Credit Union name']' is of type 'String'. The result must be a valid array.

 

i have done some research and think there is a need to use JSON to parse the info but am not sure exactly how to go about that. Please help me understand what resources to use in order to understand how to correctly parse this information so the Flow will work correctly.

 

{
    "inputs": {
        "host": {
            "connectionName""shared_sharepointonline_1",
            "operationId""GetItems",
            "apiId""/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
        },
        "parameters": {
            "dataset""hiddenonpurpose",
            "table""hiddenonpurpose",
            "$filter""Title eq '@{items('Apply_to_each')?['Charter number']}'",
            "$top"1
        },
        "authentication""@parameters('$authentication')"
    }
}
13 REPLIES 13
ScottShearer
Super User
Super User

@curthulbert 

Please post a screen shot of your Flow - that will make it much easier to assist.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

It is a fairly simple Flow. It is pulling data from an .xlsx file and importing it into a SharePoint List. It tests to see if the record exists and then will update the list or if the record does not exist it adds to the list. I am gathering up screen shots now and will post in just a few.

This is the simple Flow:

1.PNG

It grabs the body values from the .xlsx file: 

Value.png

And then fails due to a type casting error or parsing error:

2.PNG

This is the outline of that part of the Flow:

3-a.png

Here is the XML code:

{
"inputs": {
"host": {
"connectionName": "shared_sharepointonline_1",
"operationId": "GetItems",
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
},
"parameters": {
"dataset": "hiddensharepointpath/sites/AuxSales",
"table": "hiddentableid",
"$filter": "Title eq '@{items('Apply_to_each')?['Charter number']}'",
"$top": 1
},
"authentication": "@parameters('$authentication')"
}
}

nc1
Frequent Visitor

Could you please provide a screenshot of what your Apply to each actions look like in the edit window?

curthulbert
Frequent Visitor

I have added the apply to each flow as an image and as xml. Here is an image of the Full Apply to each section:

Full Apply to Each sectionFull Apply to Each section

ScottShearer
Super User
Super User

@curthulbert 

It's difficult to get a handle on the big picture, but I believe the issue is that the Credit Union name is not an array but a single value - therefore you can't loop through.  Does a Credit Union Name appear more than once in your Excel table?

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

You are correct as it is a single row column value in a table of 5000+ records. It is a list of 5000+ Credit Unions with about 15 columns that pushes data to a Credit Union SharePoint List with the same table layout. I did not create this Flow just inherited it but it did work at one point, lol. 

nc1
Frequent Visitor

It appears that you need to iterate over something at a higher level rather than the individual column name if possible, considering it doesn't look like you need to access the credit union name within the query itself. As Scott said, the dynamic credit union name only provides a string according to your error. 

@curthulbert 

Please note that if you are using the Power Automate license that comes with M365 that a for each lo...

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,885)