Dynamic Table Constructs
Add dynamic behaviour to a table using dynamic table columns constructs to discard column or set of columns at runtime.
Dynamic table columns#
Discard a column or set of columns in a table from the final generated document as follows :
Discard column if empty#
Column in a table can be discarded if every element of an array in the input json is empty or null.
How to use
Add discard-if-empty construct with boolean false/true along with the template tag to activate discard if empty feature for the corresponding column.
JSON representation of the input data:
Json 1
Copied to your clipboard1{2 "Project": [3 {4 "Name": "ABC Infra",5 "Milestone": "First Milestone",6 "DateComplete": "24/06/2021",7 "Notes": ""8 },9 {10 "Name": "ABC Infra",11 "Milestone": "Second Milestone",12 "DateComplete": "24/06/2022",13 "Notes": ""14 },15 {16 "Name": "DEF Computer Labs",17 "Milestone": "First Milestone",18 "DateComplete": "12/12/2021",19 "Notes": ""20 },21 {22 "Name": "DEF Computer Labs",23 "Milestone": "Second Milestone",24 "DateComplete": "12/12/2021",25 "Notes": ""26 }27 ]28}
Json2
Copied to your clipboard1{2 "Project": [3 {4 "Name": "ABC Infra",5 "Milestone": "First Milestone",6 "DateComplete": "24/06/2021"7 },8 {9 "Name": "ABC Infra",10 "Milestone": "Second Milestone",11 "DateComplete": "24/06/2022"12 },13 {14 "Name": "DEF Computer Labs",15 "Milestone": "First Milestone",16 "DateComplete": "12/12/2021"17 },18 {19 "Name": "DEF Computer Labs",20 "Milestone": "Second Milestone",21 "DateComplete": "12/12/2021"22 }23 ]24}
- {{Project.Notes:discard_if_empty(true)}} tag lets the engine discard the particular column if every element of an array in the input json is either empty or null.
Note: The row above the authored row will be considered as a header row. Cell from the header row will be discarded along with discarded column.
Discard column if condition evaluates to true#
Column in the table can be discarded If condition provided in the discard-if(expr(condition)) evaluates to true. Add discard-if(expr(condition)) construct along with the template tag to activate discard if feature for the corresponding column.
JSON representation of the input data:
Copied to your clipboard1{2 "Conversion": [3 {4 "Month": "July, 2021",5 "Rate": 10,6 "Method": "Payout by Cheque"7 },8 {9 "Month": "September, 2021",10 "Rate": 30,11 "Method": "Payout by Cheque"12 },13 {14 "Month": "Dec, 2021",15 "Rate": 20,16 "Method": "Payout by Cheque"17 },18 {19 "Month": "April, 2022",20 "Rate": 20,21 "Method": "Payout by Cheque"22 },23 {24 "Month": "Dec, 2022",25 "Rate": 30,26 "Method": "Payout by Cheque"27 }28 ]29}
- {{Conversion.Rate:discard-if(expr($sum(Conversion.Rate)!= 100))}}% tag lets the engine discard the particular column if condition provided in the expr construct evaluates to true.