Professional > Table scripting > Table presentation > Hiding rows, columns, and cells > Hide rules based on a single row or column > Hide rules in nested tables
 
Hide rules in nested tables
If the element on which you want to base the hide rule is in the inner variable of a nested table, you can specify it using the syntax for nested elements in the ElementRef parameter. For example, here is a nested table with the specification age * before{yes,no} > biology{yes,no}.
To hide rows where the value is less than 50 in the highlighted column (the column for those who answered Yes to the biology question within the Base section of the before question) use the following script:
With Tables.AddNew("Table12", "age * before{yes,no} > biology{yes,no}", _
"Nested table with hide rule on inner nested element")
Set Rule = .Rules.AddNew()
Rule.Type = 0 ' hide
Rule.Target = 0 ' row
Rule.CellItemRef = 0 ' if cellitem 0
Rule.Operator = 0 ' is less than
Rule.Value = 50 ' 50
Rule.ElementRef = "before{base} > biology{yes}"
' for inner nested element()
End With
Here is the table produced by the script:
If the element on which you want to base the hide rule is in an outer nested variable, you need only specify the outer element.
This script hides rows where the value is less than 50 in the Base section of the before question:
With Tables.AddNew("Table13", "age * before{yes,no} > biology{yes,no}", _
"Nested table with hide rule on outer nested element")
Set Rule = .Rules.AddNew()
Rule.Type = 0 ' hide
Rule.Target = 0 ' row
Rule.CellItemRef = 0 ' if cellitem 0
Rule.Operator = 0 ' is less than
Rule.Value = 50 ' 50
Rule.ElementRef = "before{base}" ' for outer nested element()
End With
Here is the table produced by the script:
See also
Hide rules based on a single row or column