In the modified code this is exactly what I did. Please see the code below. However that did not work, it formatted properly when there was no data, but no longer did when there was data. Unless you mean implementing this in the pipeline and not the code in which case, I do not know how to do an if-then condition in a pipeline. Could you assist if that is what you mean?
Modified code:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}
</style>
<h2>Report Name</h2>
{% if a.json.data|length > 0 %}
<table>
<tr>
{# Loop through the Fields object to create the table headers #}
{% for object in a.json.fields %}
<th>{{object['label']}}</th>
{% endfor %}
</tr>
{# Loop through the records and create a row #}
{% for record in a.json.data %}
<tr>
{# Loop though fields #}
{% for field in a.json.fields %}
{# Grab the records field data and format based on Field Type #}
{% if field['type'] == 'percentage' %}
<td>{{"{:,.2f}%".format(record[field['id'] | string]['value'] | float * 100)}}</td>
{% elif field['type'] == 'currency' %}
<td>{{"${:,.2f}".format(record[field['id'] | string]['value'] | float)}}</td>
{% elif field['type'] == 'user' %}
{# Retrieve the user's name from the 'user' field #}
{% set user_data = record[field['id'] | string]['value'] %}
{% set user_name = user_data['name'] %}
<td>{{ user_name }}</td>
{% else %}
<td>{{record[field['id'] | string]['value']}}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</table>
{% else %}
<p>All Time Entries Approved</p>
{% endif %}
------------------------------
William Hunter
------------------------------