cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ComputerHabit2
Responsive Resident
Responsive Resident

Display Appended comments

 

I'm trying to follow this article about displaying appended comments.  

Display Appended Comments Version History From SharePoint List On PowerApps (c-sharpcorner.com)

 

I get the idea of the article but I'm having trouble on the Flow I need to build to return the information from the site.

 

In the flow I am to retrieve the comments using a REST query.  That returns the XML data and I use a Parse JSON command to filter.  (I think I'm saying that right)....

 

When I run the flow it errors:

ComputerHabit2_1-1631106809202.png

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['properties']?['value']' is of type 'Null'. The result must be a valid array. 

 

This error makes me think something in the previous command failed and there needs to be a 'properties' value that isn't there.  I'm not sure really.  I can take the same rest query and see the comment field so I know there's data. 

In the article he uses this schema:

 

 

{  
    "type": "object",  
    "properties": {  
        "value": {  
            "type": "array",  
            "items": {  
                "type": "object",  
                "properties": {  
                    "Comment": {  
                        "type": "string"  
                    }  
                },  
                "required": ["Comment"]  
            }  
        }  
    }  
} 

 

 

 

I'm not sure if the "Comment" in the schema is the name of the column needing to be returned.  My column comment field has a different name.  I tried replacing it with the name of my column and it still fails.  

Can anyone who has done this before tell me what the issue is?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

The Appended comments puts each set of comments into the comments field for each version.  The problem you are running into is that some versions don't include any comments.  I normally add a filter array after the parse Json to filter out any versions that don't include comments.  Then run your apply to each on the result.  You'll probably need to re-do your Parse JSON after doing the filter array to regain access to the individual properties in the result.



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

View solution in original post

5 REPLIES 5
Pstork1
Dual Super User
Dual Super User

The Appended comments puts each set of comments into the comments field for each version.  The problem you are running into is that some versions don't include any comments.  I normally add a filter array after the parse Json to filter out any versions that don't include comments.  Then run your apply to each on the result.  You'll probably need to re-do your Parse JSON after doing the filter array to regain access to the individual properties in the result.



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

I keep searching for what you mean.  So far no luck.  

ComputerHabit2
Responsive Resident
Responsive Resident

I'm getting closer.  I found "filter array" and I'm attempting to filter out the empties.  So far no luck. 

ComputerHabit2_0-1631116060357.png

 

I got it working.  

 

Filtering the array helped.  I also removed the type information from the JSON so it wouldn't error on the nulls.

 

ComputerHabit2_1-1631116656313.png

 

Instead of removing the "type" from the JSON schema you should expand it to include nulls.  Use this

 

"type":  ["string", "null"]



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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,583)