Conditional text and Boolean expressions

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
ajpeck123
Propeller Head
Posts: 37
Joined: Tue Mar 07, 2017 6:01 am

Conditional text and Boolean expressions

Post by ajpeck123 »

Hi there,

I just want to see what the most elegant way is to solve my problem...

I have three sets of conditon tags:
Platforms (windows, unix, etc)
Products (product A, product B - although these are actually more like product types)
Output (PDF and online)

So far it's worked well, as I've only ever had to apply conditions from one SET. So exclude product A and product B, include product C gets me everything tagged just with product C and also anything tagged with A and C, B and C or A, B and C. So far so good.

I've also applied web-only and PDF only conditions - the latter mainly for cross-references as the html pages do not cross reference at all.

BUT I know have a couple of paragraphs that I have tagged Product C and PDF, because they only apply to Product C *and* only apply to PDF.

Problem - if I generate a PDF for Product A, set to exclude Product-C specific stuff but to INCLUDE PDF stuff (because most of the PDF conditional text contains cross references), I will get the chunk of information for Product C because it also includes the PDF condition tag.

So, do I do what I had to do in FM because the boolean expressions were not good, and end up creating conditions for ProdAPDF, ProdAOnline and so on? Or is there a better way of saying I *really* don't want Prod C even if PDF *is* selected?


Thanks in advance,
Alison
Last edited by ajpeck123 on Tue Jun 12, 2018 12:26 am, edited 1 time in total.
Alison
Lone technical author - Flare user since March 2017
Currently using Flare 2020
ajpeck123
Propeller Head
Posts: 37
Joined: Tue Mar 07, 2017 6:01 am

Re: NEWBIE questions - condition tags...

Post by ajpeck123 »

There's something about asking the question that makes you think about possible answers... I've just hunted for and found the Advanced settings for conditional text with targets. It's going to take some thinking about!
Alison
Lone technical author - Flare user since March 2017
Currently using Flare 2020
whunter
Sr. Propeller Head
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR

Re: NEWBIE questions - condition tags...

Post by whunter »

BTW, you don't have to include a condition in order to include the content. By default, all conditions are included unless they are excluded.

You only need to explicitly include for situations like you have described, where you have tagged the same content with 2 tags, and one of the tags is excluded. In order to include the other content, you must explicitly include it (to override the other exclude). This may make you rethink how you have tagged.
ajpeck123
Propeller Head
Posts: 37
Joined: Tue Mar 07, 2017 6:01 am

Re: NEWBIE questions - condition tags...

Post by ajpeck123 »

@whunter. Thank you. I had realised that "no tags" means included by default, but I had forgotten one of the implications... and it's made it so much simpler.
I may have elements with condition tags for more than one product but I will never have elements marked for both PDF and HTML. They are mutually exclusive, and are the same as having no tags.
So my solution is actually quite simple.

To get PDF stuff for Product A without getting EITHER PDF for other products or HTML for product A:

Step 1: In the BASIC editor for setting conditions at target level, I exclude all products except Product A and explicitly include that one (as some things will be tagged for more than one product).
Step 2: In the BASIC editor, I exclude HTML condtions but do NOT include PDF ones. By default, they will be there - and this is the bit that was making the next steps much more complex than they needed to be.

That gives me all PDF for my Product A but also HTML for Product A because I specifically *included* the product, so:

Step 3: Switch to ADVANCED editor, and copy the expression.
Step 4: Put the whole thing in brackets and add a bit:
(<expression from basic editor>) AND NOT(HTML AND PRODUCT A)

Solved, and with minimal effort. Yes, I will have to redo as I get more products to exclude, but if I take a note of Step 4 above, it's a really quick update.


Thanks for talking it through with me :wink:

Alison
Alison
Lone technical author - Flare user since March 2017
Currently using Flare 2020
ajpeck123
Propeller Head
Posts: 37
Joined: Tue Mar 07, 2017 6:01 am

Conditional text and Boolean expressions

Post by ajpeck123 »

Well, I thought it was much simpler and I had it sussed...
*I changed the post title to make it perhaps easier to find...*

Then I created a single test topic, applied conditions in various ways, indicated whether I expected that statement to appear or not and built the target.

First of all I'd got too much in - so I excluded some combinations. Then I was missing stuff I needed!

I'm still running through a few more tests, and I think I've got it now... BUT although this works on my test topic, does anyone have experience of running complex selections on whole projects?

*NOTE*: I'm not expecting anyone to review and comment on the statement (further down)! I just want to know if this level of complexity is too much for Flare! The plan is do the complex stuff once, then applying the tags is intuitive. The alternative is to say "Don't ever apply Product and Appliance tags to the same chunk of material..." and hope this is always remembered and alternative ways of organising the content to have the same effect can be found!

As an example, if I *include* ProductA (because some stuff is tagged for more than one product type and otherwise would be excluded), I get everything tagged ProductA even if it is for the wrong operating system. So I have had to exclude everything tagged ProductA AND an operating system I don't want UNLESS it's also tagged for the operating system I do want!

I had a similar problem with FM and ended up creating 3 conditional tags per product, one for each operating system... but this meant applying three tags nearly all the time and I'm trying to avoid it with Flare. It *mainly* affects the topics relating to installation, permissions and so on (different techniques on Windows and Linux - Appliance is based on Linux but with restrictions).

The whole statement is below, and afterwards it is broken down by section with comments on *why* I think I need that bit. The only other way I could think of to simplify this would be to put product-specific stuff in another topic when it also needs tagging by platform, and only including the appropriate topics in the relevant ToCs (I'm using one ToC for each Target as the same topics are often reused but in very different locations in the PDF - they may be the main reason for having one product but an "oh, and you can also..." in another)...but that may mean a large number of relatively small topics so I can isolate the chunks affected.

Platform.Appliance OR Products.A OR NOT (Platform.Linux OR Platform.Windows OR Products.B OR Products.C OR Products.D OR Products.E OR Products.F) AND NOT (Notes.AuthorNote OR Notes.CommentedOut OR Notes.ForReviewer OR Output.Help-only) AND NOT (Platform.Appliance AND (Products.B OR Products.C OR Products.D OR Products.E OR Products.F) AND NOT (Products.A)) AND NOT (Product.A AND (Platform.Linux OR Platform.Windows) AND NOT (Platform.Appliance))

Broken down...

Part 1 - we don't want anything tagged for anything _else_ *unless* it's also tagged for the platform and product we want (I can do this with the Basic editor)...

Platform.Appliance OR Products.A OR NOT (Platform.Linux OR Platform.Windows OR Products.B OR Products.C OR Products.D OR Products.E OR Products.F)

Part 2 - we don't want anything from the Notes group in customer facing material (take Notes.ForReviewer out of the list for Review PDFS) and we don't want the incorrect format - regardless of how else these things are tagged. Removing ForReviewer from this list *allows* it in without *forcing* it in when it's tagged for other platforms/products.

AND NOT (Notes.AuthorNote OR Notes.CommentedOut OR Notes.ForReviewer OR Output.Help-only)

Parts 3 and 4 are more complex. Allowing anything in with a tag of Platform.Appliance or Products.A will include anything tagged with Platform.Appliance even if the tag combination is (for example) Products.B and Platform.Appliance. A similar problem exists with including anything with the Products.A tag (other tags may be Platform.Windows or Platform.Linux and the information may not be applicable to the appliance). We need to exclude products where one tag includes them but others should exclude...

Part 3 - although we want things tagged Platform.Appliance, we don't want anything tagged Platform.Appliance *and* other products *unless* the list of products includes Products.A.

AND NOT (Platform.Appliance AND (Products.B OR Products.C OR Products.D OR Products.E OR Products.F) AND NOT (Products.A))

Part 4 is the equivalent for the Product.A tag

AND NOT (Product.A AND (Platform.Linux OR Platform.Windows) AND NOT (Platform.Appliance))
Alison
Lone technical author - Flare user since March 2017
Currently using Flare 2020
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Conditional text and Boolean expressions

Post by ChoccieMuffin »

I HATE advanced conditions, and always have to copy them out to a text editor then put line feeds in so I can see what's what.

I would hate to share the conditions I use in some of my projects, they have my head spinning any time I look at them too closely!

But in brief, it's not too difficult for Flare to handle.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ajpeck123
Propeller Head
Posts: 37
Joined: Tue Mar 07, 2017 6:01 am

Re: Conditional text and Boolean expressions

Post by ajpeck123 »

I've sorted it, it works and I'm happy. This is pretty much a one-time exercise, with maybe a copy/paste and do a bit of inserting of product types (if ever we get more) but no-one has to think too hard when *using* the condition tags. If it's in, tag it. :)

I've created myself a large-ish topic including all the variables (many are set by the target) and variants on conditions (it took quite a while, but is now part of my standard "test kit"), which I am inserting at the end of my ToC for a particular product set, building the PDF to check I see in that topic what I expect, then removing the topic and rebuilding.

Alison
Alison
Lone technical author - Flare user since March 2017
Currently using Flare 2020
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Conditional text and Boolean expressions

Post by ChoccieMuffin »

ajpeck123 wrote:I've created myself a large-ish topic including all the variables (many are set by the target) and variants on conditions (it took quite a while, but is now part of my standard "test kit"), which I am inserting at the end of my ToC for a particular product set, building the PDF to check I see in that topic what I expect, then removing the topic and rebuilding.

Alison
What a brilliant idea - definitely one to use on my very confusing advanced conditions!
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Gav74
Jr. Propeller Head
Posts: 6
Joined: Wed Jun 06, 2018 4:32 am

Re: Conditional text and Boolean expressions

Post by Gav74 »

I'm trying to use your example here to help me with my condition nightmare I'm having but I don't seem to be able to make it work.

I have one topic, with 2 conditional paragraphs:
P1: <p MadCap:conditions="Output.PDF/Print Only,Roles.Investor">
P2: <p MadCap:conditions="Output.PDF/Print Only,Roles.Admin">

The target condition expression is:
"Output.Online Only" or Products.Select or Roles.Investor or not ( "Output.Not ready yet" or "Output.PDF/Print Only" or Products.Access or Products.Solutions or Roles.Admin or "Roles.Admin Home" or Roles.Sponsor ) AND NOT ( "Output.PDF/Print Only" AND Roles.Investor )

where everything before the AND NOT is from the basic editor, and I added AND NOT ( "Output.PDF/Print Only" AND Roles.Investor )

The output from this results in P1 is displayed, but P2 is not. I was trying to end up with both paragraphs excluded.

Could anyone offer any suggestions please?
Post Reply