Skip to main content
Participating Frequently
November 15, 2022
Question

Problem with writing a proper condition expression in RH20

  • November 15, 2022
  • 26 replies
  • 2075 views

Hi, I'm struggling to understand the logic of condition expressions and I have a hard time defining the expression that meets my needs.

I have three client tags : Client A, Client B, Client C.

I have two output tags : Online and Print

Text can be tagged with multiple tags, since some functions are common to Client A and B, or Client A and C, or Client B and C.

Furthermore, in my help topics, I have links to help pages that are specific to one client and that are tagged with Online and Client A, or Online and Client B, etc. And I have links that are common to all clients that are tagged only with Online (since I don't want them in a printed output). 

When I produce my online help for Client A, I want to see text that is tagged with : 

  • Client A
  • Client A and Client B
  • Client A and Client C
  • Online
  • Client A and Online
  • Client A and Client B and Online
  • Client A and Client C and Online

I have successfully built a condition expression that includes all the text tagged Client A, whether alone or in combination with another Clients tag or with the Online tag, and excluded any text tagged with Print. Which is almost what I want.

However, I can't find a way to include also text that is tagged with Online only. Is it possible ? If yes, how ?

 

Here is the condition that I have written so far.

     EXCLUDE when Clients is B

     OR

     EXCLUDE when Clients is C

     AND

     EXCLUDE when Output is Print

     AND

     INCLUDE when Clients is A

 

Whenever I want to introduce Online either with AND or OR, I don't get the result I want.

My first try was to add "OR INCLUDE when Output is Online" at the end, but this makes all texts tagged with Online visible, including the text not tagged with Client A but tagged with Client B and/or Client C that I want hidden.

I have made several other attemps by moving my "OR INCLUDE when Output is Online" elsewhere in the condition, and I also tried with "AND INCLUDE when Output is Online" at various places, but I can't get the right result. I can't understand the logic...

Does anyone have a solution ?

Thanks in advance.

    This topic has been closed for replies.

    26 replies

    Community Expert
    March 1, 2024

    Okay, I found the logic (but it's different from the Classic logic where reversing the grouping made no difference).

     

    You have to evaluate each step of the condition sequentially by adding for an Include step and removing for an exclude step.

     

    So for (Client_A AND NOT print) OR (Online AND NOT Client_B AND NOT Client_C):

    1. Select everything with Client_A

    2. Remove anything from the selection that includes Print.

    3. Add to the selection anything that includes Online (even if you previously removed it)

    4. Remove anything from the selection that include Client_B or Client C.

     

    Here's my working:

    All Tag Combinations Select Untagged Select all A Remove Print Add all Online Remove B and C
    Untagged Untagged Untagged Untagged Untagged Untagged
    Print only   Client A Client A Online only Online only
    Online only   Client A and Online Client A and Online Client A Client A
    Client A   Client A and Print Client A and Client B Client A and Online Client A and Online
    Client B   Client A and Client B Client A and Client C Client B and Online  
    Client C   Client A and Client C Client A and Client B and Online Client C and Online  
    Client A and Online   Client A and Client B and Online Client A and Client C and Online Client A and Client B  
    Client B and Online   Client A and Client C and Online   Client B and Client C  
    Client C and Online   Client A and Client B and Print   Client A and Client B and Online  
    Client A and Print   Client A and Client C and Print   Client B and Client C and Online  
    Client B and Print       Client A and Client C and Online  
    Client C and Print          
    Client A and Client B          
    Client B and Client C          
    Client A and Client C          
    Client A and Client B and Online          
    Client B and Client C and Online          
    Client A and Client C and Online          
    Client A and Client B and Print          
    Client B and Client C and Print          
    Client A and Client C and Print          

     

    Similarly for (Online AND NOT Client_B AND NOT Client_C) OR (Client_A AND NOT Print):

    1. Select everything with Online

    2. Remove everything from the selection contaiing Client_B or Client C.

    3. Add to the selection anything containing Client_A (even if you just removed it)

    4. Remove from the selection anything containing Print.

     

    And again, my working:

    All Select Untagged Add all Online Remove B and C Add all A Remove Print
    Untagged Untagged Untagged Untagged Untagged Untagged
    Print only   Online only Online only Online only Online only
    Online only   Client A and Online Client A and Online Client A Client A
    Client A   Client B and Online   Client A and Online Client A and Online
    Client B   Client C and Online   Client A and Print Client A and Client B
    Client C   Client A and Client B and Online   Client A and Client B Client A and Client C
    Client A and Online   Client B and Client C and Online   Client A and Client C Client A and Client B and Online
    Client B and Online   Client A and Client C and Online   Client A and Client B and Online Client A and Client C and Online
    Client C and Online       Client A and Client C and Online  
    Client A and Print       Client A and Client B and Print  
    Client B and Print       Client A and Client C and Print  
    Client C and Print          
    Client A and Client B          
    Client B and Client C          
    Client A and Client C          
    Client A and Client B and Online          
    Client B and Client C and Online          
    Client A and Client C and Online          
    Client A and Client B and Print          
    Client B and Client C and Print          
    Client A and Client C and Print          
    Participating Frequently
    March 1, 2024

    Thanks for this. Nicely laid out. I'm going to try to wrap my head around it, but it will take a bit of time. When I get a chance I'll try different combinations of

    OR - Include

    OR - Exclude

    AND - Include

    AND - Exclude

    to see if that adds a new complication.

    Community Expert
    March 1, 2024

    Wow...

     

     

    This expression:

    produces this:

     

    If I switch the order of the groupings:

    it produces this:

    This is the required output I believe.

     

    I set it all up in a spreadsheet and tried to manually select the paragraphs using different interpretations of the logic but can't come up with any consistent logic to achieve each outcome. Only Adobe can answer and/or determine if there is a logic error in the code somewhere.

     

    In any case @Milsademon may be interested to know there's a solution that doesn't require extra condition tags, if they want to re-do it at some stage.

     

    Community Expert
    February 29, 2024

    Hi @Sundorne Thanks for posting your testing.

     

    My expression (which worked in Classic) writes out using your #1 logic as:

    (A AND NOT Print) OR (Online AND NOT B AND NOT C)

     

    However, in new UI it is excluding content tagged (Online AND A)

     

    I also am not sure I understand your #4 - are you saying you can only use INCLUDE once per expression or only one per condition tag?

     

    Participating Frequently
    March 1, 2024

    Hi @Amebr Hmmm, #4 might actually explain some of the issues, if only I understood what it actually means. 😞

     

    The condition expression seems to be very sensitive to the order. If you re-write your expression to

    (Online AND NOT B AND NOT C) OR (A AND NOT Print)

    does it make any difference?

    If so, my explanation above is incomplete or maybe wrong. It's like the later clause breaks some of the logic from the earlier clause. I just don't know what the rules are.

    Peter Grainge
    Community Expert
    Community Expert
    November 29, 2022

    Not quite. The first two tags in your expression are not needed but they should do no harm. See my expression.

     

    Glad it's sorted.

    ________________________________________________________

    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.
    Participating Frequently
    February 29, 2024

    I'm very late to this thread, but I just spent some time working through the logic of conditional expressions. I think you can set up expressions for Print/Online and Client_A/Client_B/Client_C, etc., without needing special Client_A_Only conditions.

     

    A. Logic of condition expressions, as I understand it. I know this isn't exactly how others have explained it, but I did quite a bit of testing of different scenarios. This seems to check out, and it does map reasonably well to standard Boolean logic.
    1. All the ANDs are evaluated before the ORs. So
    "A and B or C and D" is evaluated as "(A and B) or (C and D)". This means that each OR clause is a separate test.

    2. A conditional element is included in the output if at least one of the OR clauses is true. All of the AND clauses within an OR clause must be true for the OR to be true.

    3. "Include" is true if the condition is set on an element. "Exclude" is true if the condition is not set (essentially equivalent to NOT).

    4. In my testing, it looks like an "Include" flag can only be set within one OR clause for a given value. If it's set in multiple clauses, then only the last clause is used. There might be something else going on here, but that's my best guess.

     

    B. Example:
    For my project, I have Platform as Print/Online, and Product as Prod1/Prod2/Prod3/Prod4. To generate Print output for Prod1, I want everything that is Print (without any other conditions), plus everything that is for Prod1, unless it is also tagged Online. This captures Print, Prod1, Prod1/Print, Prod1/Prod2, etc. That is,
    (Platform = "Print" AND no Product conditions set) OR (Product = "Prod1" AND Platform NOT= "Online")

     

    The .expn source looks like this. The UI will follow the same structure, but I find the .expn easier to read. As far as I can tell, the flags on the <group> element are not used for condition expressions. Maybe they are used for dynamic content filters.

    <?xml version="1.0" encoding="UTF-8"?>
    <expr>
    	<group flag="Exclude" op="AND">
    		<tag name="Platform" value="Print" flag="Include" op="AND"/>
    		<tag name="Product" value="Prod1" flag="Exclude" op="AND"/>
    		<tag name="Product" value="Prod2" flag="Exclude" op="AND"/>
    		<tag name="Product" value="Prod3" flag="Exclude" op="AND"/>
    		<tag name="Product" value="Prod4" flag="Exclude" op="OR"/>
    		<tag name="Product" value="Prod1" flag="Include" op="AND"/>
    		<tag name="Platform" value="Online" flag="Exclude" op="OR"/>
    	</group>
    </expr>

     

    Peter Grainge
    Community Expert
    Community Expert
    November 28, 2022

    Be aware B_Only is not a duplicate tag, it is a different tag.

    ________________________________________________________

    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.
    Participating Frequently
    November 29, 2022

    I finally got it !

    @Peter Grainge Your reminder finally triggered illumination 🙂 : 

    "The key thing to remember is

    • With AND expressions any content that has any one of the tags will get excluded.
    • With OR expressions all the tags in the expression have to on the content."

    Below is the condition expression that I ended with (after creating the additional tags Client_A_Only, Client_B_Only, as you suggested, and retagging my text with those tags), which works when I generate my online help for Client A and that I can easily transpose to Client B and it also works !!!

    And here is the result, which is exactly what I want.

    Thank you very much again @Peter Grainge and @Amebr !!!

    Peter Grainge
    Community Expert
    Community Expert
    November 28, 2022

    It requires some new tags but the expressions will be shorter. I'll let you know if I get more information from Adobe.

    ________________________________________________________
    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
    November 26, 2022

    Maybe not but it solves the issue. I will flag this with Adobe. 

    ________________________________________________________
    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.
    Community Expert
    November 26, 2022

    Ah you mean with your duplicate condition tag work around. Yes, with the duplicate (Client_B_only) condition tags you wouldn't need to use Include. But in my opinion, having the duplicate tags shouldn't be needed (and wasn't in Classic)

    Peter Grainge
    Community Expert
    Community Expert
    November 26, 2022

    The image in the output image tells you which tags are applied. Unless I have got it wrong, what is shown above the image is what is required for Client A.

    ________________________________________________________
    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.
    Community Expert
    November 26, 2022

    @Peter Grainge You have to use "Include" in this case, otherwise the paragraphs tagged with multiple conditions are excluded because those other conditions are excluded - It's sort of an override. I think that's what might be different with New UI - it's not handling the "include" statement properly.

    Peter Grainge
    Community Expert
    Community Expert
    November 26, 2022

    I'll send you my project tomorrow and you will see they are getting included. It's also shown in my images.

    ________________________________________________________
    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.