A table like so:
| header 1 | header 2 |
|---|---|
| cell 1 | cell 2 |
| cell 3 | cell 4 |
Will be serialised as follows:
{
"columns": [
{
"header": "header 1",
"index": 0
},
{
"header": "header 2",
"index": 1
}
],
"rows": [
{
"header 1": "cell 1",
"header 2": "cell 2"
},
{
"header 1": "cell 3",
"header 2": "cell 4"
}
]
}
Within the flow (in JavaScript) the read table could be accessed;
var table = Fields["my-table"].read();
// Show a dialog with the contents of cell3
Debug.showDialog(table.rows[1]["header 1"]);
// Loop through the 2nd column
for (var i=0; i<table.rows.length; i++) {
Debug.showDialog(table.rows[i]["header 2"]);
}
Any complex content will get serialised to json using xml2json. The textual content of a complex item will be available in the text property.
A few examples are given below.
A table like so:
| header 1 | header 2 |
|---|---|
| cell 1 | cell 2 |
| cell 3 | cell 4 |
Will be serialised as follows:
{
<table-path>: {
"thead": {
"tr": {
"th": [
"header 1",
"header 2"
]
}
},
"tbody": {
"tr": [
{
"td": [
"cell 1",
"cell 2"
]
},
{
"td": [
"cell 3",
"cell 4"
]
}
]
},
"text": "header 1\theader 2\ncell 1\tcell 2\ncell 3\tcell 4"
}
}