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

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 III
Dual Super User III

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 III
Dual Super User III

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

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

ComputerHabit2
Helper V
Helper V

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
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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,543)