Skip to main content
Adobe Employee
March 26, 2026
Question

Document Generation: Dynamic columns discard-if + context $ Title: discard-if: multiple conditions + , $ root context not working

  • March 26, 2026
  • 0 replies
  • 3 views

I am using the Document Generation API with a Word template (dynamic table with table markers) and want to conditionally discard a column based on values coming from different levels of the input JSON.

I want to remove a column when either of the following conditions is true:

  1. The current row’s product name equals a specific value (row-level context), OR
  2. A root-level boolean flag show_pricing is false

 

{
"data": {
"approved_quote": true,
"bypass_approval": false,
"group_family": {
"products": [
{
"name": "Product A",
"items": [
{
"end_date": "31 Dec 2025",
"prices": [{ "net_price": "$100" }]
}
]
},
{
"name": "Some Other Product",
"items": [
{
"end_date": "15 Jan 2026",
"prices": [{ "net_price": "$200" }]
}
]
}
]
}
},
"show_pricing": false
}

 Template fragments I tried:

  1. {{items.end_date:discard-if(expr(name = "Product A" or $.show_pricing = false))}}
  1. {{items.end_date:discard-if(expr(show_pricing = false), $)}}

Tried 2nd one to test context tag is really working but, It didn’t work in my case