Instead of creating a custom HTML table, you use the "Create HTML table" action and modify its output.
Here an example creating such a table from following example data:
[
{"Name":"Jim", "Value0": 0, "Value1": 1},
{"Name":"John", "Value0": 0, "Value1": 0},
{"Name":"Jim", "Value0": 10, "Value1": 11},
{"Name":"Jane", "Value0": 0, "Value1": 1},
{"Name":"Jane", "Value0": 10, "Value1": 11},
{"Name":"Jim", "Value0": 20, "Value1": 21}
]
From the array (sorted by Name) in a Compose, Create HTML table
Initialize variable with this HTML
Apply to each distinct Name
union(
xpath(
xml(json(concat('{"Root":{"Item":',outputs('Compose'),'}}'))),
'//Item/Name/text()'
),
json('[]')
)
In a Compose 2, find the first occurence of the td with the Name and add a rowspan to it. The value is the count of this Name in the data array.
Also add a CSS class to the tr.
remove the td with this Name from the rest of the table.
concat(
replace(
slice(
variables('htmlTable'),
0,
nthIndexOf(
variables('htmlTable'),
concat('<tr><td>',items('Apply_to_each'),'</td>'),
2
)
),
concat('<tr><td>',items('Apply_to_each'),'</td>'),
concat('<tr class="namerow"><td rowspan="',
length(
xpath(
xml(json(concat('{"Root":{"Item":',outputs('Compose'),'}}'))),
concat('//Item[Name="',items('Apply_to_each'),'"]')
)
),
'">',items('Apply_to_each'),'</td>')
),
replace(
slice(
variables('htmlTable'),
nthIndexOf(
variables('htmlTable'),
concat('<tr><td>',items('Apply_to_each'),'</td>'),
2
)
),
concat('<tr><td>',items('Apply_to_each'),'</td>'),
'<tr>'
)
)
Use Set variable store the output of Compose 2
After the loop, add some styles to the HTML in Compose 3
The resulting table needs some additional styles to look great ;)