How do I run a collection with a visualize output

Hi how do i run a collection with a visualize out put
here is the test code
var template = `

<style type="text/css">

    .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}

    .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}

    .tftable tr {background-color:#ffffff;}

    .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}

    .tftable tr:hover {background-color:#e0ffff;}a

</style>

<table class="tftable" border="1">

    <tr>

        <th>id</th>

        <th>account_id</th>

        <th>Ref id</th>

        <th>description</th>

        <th>created_at</th>

        <th>folder</th>

        <th>thumbnail</th>

        <th>text_tracks</th>

        <th>published_at</th>

    </tr>

    {{#each response}}

        <tr>

            <td>{{id}}</td>

            <td>{{account_id}}</td>

            <td>{{reference_id}}</td>

            <td>{{description}}</td>

            <td>{{created_at}}</td>

            <td>{{folder}}</td>

            <td>{{tnsrc}}</td>

            <td>{{ttsrc}}</td>

            <td>{{published_at}}</td>

        </tr>

    {{/each}}

</table>

`;

// Set visualizer

pm.visualizer.set(template, {

response: JSON.parse(responseBody)

});

thanks

From this documentation page (https://learning.postman.com/docs/sending-requests/visualizer/#rendering-html) it looks like you need to use response: pm.response.json() instead of JSON.parse(responseBody), I think responseBody was an older method? If that doesn’t work, please post any errors you’re receiving.

Hi @jmaugeri , thanks for your reply.
I have managed to run a visualize output with 1 request. I want to be able to run a collection of requests and I wandered how I would to that with a table visualize output
Please see my attachment

I just need help with that.
Thanks
Zara

You would need to store all of the JSON response data in one larger JSON object and then pass that object to the visualizer when you’re done with your final request.

Hi @jmaugeri ,
I have stored the data in a JSON response object please below.

{

"id": "{{id}}",
"account_id": "{{account_id}}",
"reference_id": "{{reference_id}}",
"folder_id": "{{folder_id}}",
"created_at": "{{created_at}}",
"published_at": "{{published_at}}",
"images": {
    "thumbnail": {
        "src": "{{tnsrc}}"
    }
},
"text_tracks": [{
    "src": "{{ttsrc}}"
}]

}

//
Can I ask you, how do I pass the object to the visualizer when done with your final request.
Thanks for your help
Zara

Hi @jmaugeri,
I tried adding the collection but the output was not visualized


if you could help that would be great
zara