Skip to main content
Inspiring
July 23, 2025
Answered

Conditional Build expressions - logic behind

  • July 23, 2025
  • 4 replies
  • 242 views
Hello everyone,
 
I'd like to once again tap into the collective knowledge of the community – this time it's about Conditional Build Expressions. I'm using RoboHelp 2022 (Update 5) and I'm currently trying to figure out which (logical) combinations can be used to generate output.
 
For example, I have:
  • Text A (with Condition A)
  • Text B (with Condition B)
  • Text A + B (with Condition A and Condition B)
  • Text C (with Condition C)
  • Text D (with Condition D)
  • Text C and D (with Condition C and D)
In my case, I have several groups of conditions: A and B are market-specific (e.g., EU and US), while C and D are functionality-specific (Feature C and D of a software).
 
What I would like (a Christmas wish list 😉) is the ability to group conditional tags by type and logically link them together.
For example:
  • Show everything labeled with Market A (including Text A + B)
  • Hide everything that only concerns Market B
  • Independently of that, show everything with Feature C
  • But always hide Feature D (i.e., hide Text C + D)
I've played around a bit with the expressions (UI, *.expn file, and generated output) and unfortunately, I can't figure out how to interpret these.
 
If I create an expression like:
include A
OR
exclude B
It looks like this:
<expr>
<group flag="Include" op="AND">
<tag name="Market" value="A" flag="Include" op="OR"></tag>
<tag name="Market" value="B" flag="Exclude" op="OR"></tag>
</group>
</expr>
The output is generated as follows:
Included: Text A, Text A+B, Text C, Text D, Text C+D
Not included: Text B
 
If I rewrite the expression to:
include A
AND
exclude B
It looks like this:
<expr>
<group flag="Include" op="AND">
<tag name="Market" value="A" flag="Include" op="AND"></tag>
<tag name="Market" value="B" flag="Exclude" op="OR"></tag>
</group>
</expr>
The output is generated as follows:
Included: Text A
Excluded: Text B, Text A+B, Text C, Text D, Text C+D
So even though I make no statement about tags C and D, they are included in one case and excluded in the other.
 
Does anyone know how these expressions are logically interpreted?
 
Another open question for me is how to read the "group" (<group flag="Include" op="AND"> in the *.expn file). As far as I can see, it doesn't matter whether you specify Exclude or Include, OR or AND. It's also not possible to create multiple groups – no matter what combination I tried, RoboHelp only responds to the first group specified.
 
Do you have any tips on how to possibly create multiple groups and logically link them together?
I suspect that groups are intended as "brackets" for logical operations, but I can't seem to get it to work.
    Correct answer NoWeM

    After running several tests, I’ve identified a few key points to keep in mind when interpreting expressions, which I’d like to share here. Please note that these findings are based solely on my own testing. If anyone has counterexamples or additional insights, I’d greatly appreciate it if you could share them—any information that helps shed more light on this topic is very welcome.

    General Principles:
    - Untagged text is always included.
    - By default, everything is included unless the expression explicitly restricts it to a specific "Include" (thanks to Peter for pointing this out).
    - In the XML representation of expressions, only the first group tag is considered; all subsequent ones are ignored.
    - In the XML, the last logical operator (op) of the final (lowest) tag is ignored.
    - The expression in the XML should be read as follows:
       + Top to bottom
       + Logically, an "Include A" is interpreted as “A”, while an "Exclude A" is interpreted as “NOT A”
       + The first two statements are enclosed in parentheses, then the next statement is added and enclosed again, and so on.                   For example, A AND B OR C AND D is interpreted as: ((A AND B) OR C) AND D
       + De Morgan’s laws apply.

    Conclusion:
    By following these rules, you can construct a wide range of logical expressions, and combining 'Include' and 'Exclude' statements works seamlessly—even for complex scenarios.

    4 replies

    NoWeMAuthorCorrect answer
    Inspiring
    July 30, 2025

    After running several tests, I’ve identified a few key points to keep in mind when interpreting expressions, which I’d like to share here. Please note that these findings are based solely on my own testing. If anyone has counterexamples or additional insights, I’d greatly appreciate it if you could share them—any information that helps shed more light on this topic is very welcome.

    General Principles:
    - Untagged text is always included.
    - By default, everything is included unless the expression explicitly restricts it to a specific "Include" (thanks to Peter for pointing this out).
    - In the XML representation of expressions, only the first group tag is considered; all subsequent ones are ignored.
    - In the XML, the last logical operator (op) of the final (lowest) tag is ignored.
    - The expression in the XML should be read as follows:
       + Top to bottom
       + Logically, an "Include A" is interpreted as “A”, while an "Exclude A" is interpreted as “NOT A”
       + The first two statements are enclosed in parentheses, then the next statement is added and enclosed again, and so on.                   For example, A AND B OR C AND D is interpreted as: ((A AND B) OR C) AND D
       + De Morgan’s laws apply.

    Conclusion:
    By following these rules, you can construct a wide range of logical expressions, and combining 'Include' and 'Exclude' statements works seamlessly—even for complex scenarios.

    Peter Grainge
    Community Expert
    Community Expert
    July 28, 2025

    Essentially all topics are included in an output unless an expression excludes them. Thus you likely don't need includes.

     

    If you tag something to exclude say A, that topic will be excluded so wanting to ignore that if it has C applied becomes a conflict. 

     

    I am thinking Dynamic Content Filtering might be what you want where users choose which tags they want to see according to options you set up with expressions.

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Peter Grainge
    Community Expert
    Community Expert
    July 23, 2025

    Also see https://www.grainge.org/RoboHelp/Expressions/Expressions.htm. There's a download you can use for testing. Part of the logic in the new UI is the opposite of what you would think. Adobe would like to change that but it would wreck thousands of projects. Get your mind around the logic and it's not so bad.

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Jeff_Coatsworth
    Community Expert
    Community Expert
    July 23, 2025

    Does Matt's video help at all with CBTs & Expressions? See https://www.youtube.com/watch?v=oeFP8VY62Zs 

    NoWeMAuthor
    Inspiring
    July 28, 2025

    Thanks a lot for the link, unfortunately Matt is not going into details for the conditional expressions.