Combined conditions in section hiding expression

Is it possible to define a complex condition statement with a name, and use just that name to show/hide a section instead of having to copy/paste the full condition expression into every section?

As a specific example of what I’m doing, I am making a rules summary document for board game I like to play, and I want to be able to use user variables to show/hide sections with rules for add-on expansions. Example, print rules showing the Goals expansion rules, but hide Prestige rules.

The complication is that I have some sections that are meant to show when any expansion is shown, and some that are shown only if all expansions are on. Right now it’s not that bad with just two conditions, but it’s possible things could get more complicated in future documents I make. Is it possible to have these be just one named expression (like AllHidden below) that’s evaluated every time it’s used, so I can update the user variables and down-stream calculations will be affected?

It would also help refactoring, since if I need to change the expression I can just change it in one place instead of having to manually copy/paste the same thing into multiple section settings. Like if the game gets a new expansion and I need to add a new variable to some of the expressions.

AllHidden = (HideGoals ==1) AND (HidePrestige == 1)

Unless I don’t understand the problem, define your “primary” variables as you do presently.

Define “expression” variables, i.e. when you need an expression in several locations, assign the result of the expression in a new variable and use this “cache” variable instead of repeating the conditional expr.

How do I “assign the result of the expression in a new variable”? Can you tell me the specific menus to use?

Insert a new field in the document, Variable type, Set variable variant.

This dialog has a field to give a name to the new variable. Below it, there is a large entry box to write the expression to be computed. The expression can of course reference other variables.

Do this near the location where you define your “primary” variables, usually at the beginning of the document in a dedicated page you’ll never print (then you can label the variable definitions to ease future updates when you have forgotten what you initially wrote).

I didn’t know you could use formulas in variables. This is EXACTLY what I was hoping for, thank you!