Page 1 of 1

Many conditions

PostPosted: Mon Mar 16, 2020 10:16 am
by JennyLucas
Hi experts,

I created a test project, but I can't upload it here. :(
1) Create a new blank Flare project.
2) Create conditions as follows: Set1.A, Set1.B, Set2.A, Set2.B
3) Create stylesheet classes: Set1A, Set1B, Set2A, Set2B (all they do is set the condition...)
4) Open any topic
5) Add <p class="Set1A>set1A</p>
<p class="Set2A>set2A</p>
<p class="Set1A Set2A>set 1A and 2A</p>
6) Create 2 targets
show all Set1A - I expect to see the 2 from above
Set to show only Set1A and Set2A - this does not work like I expect.

For the first target, I expect to see 2 p tags. This works as expected.
For the second target, I expect to see 1 p tag, just the last one. But no matter how I try to set the Advanced conditions on the target, I don't get my expectation.

Note, I have 3 condition sets, with 5-15 different conditions in each.

Can someone please let me know how I get my expectations?

Thanks so much!

Re: Many conditions

PostPosted: Mon Mar 16, 2020 2:39 pm
by SteveS
Conditions are applied via a checkbox or similar, you do not have to create them as a class and apply the class as inline styling.

For example, right-click a topic in the content explorer and select properties. From the properties dialog box, select conditional text. Apply the conditions by toggling the checkbox.

Select some text, click Conditions from the Attributes group on the home tab. You can apply the conditions as described above.

Conditions can be created from the Conditional Text in the Project Explorer.

Finally, you need to apply the conditions to the target. Double click the target in the project explorer, select Conditional Text and set the condition as include or exclude.


Re: Many conditions

PostPosted: Tue Mar 17, 2020 3:03 am
by ChoccieMuffin
Conditions can be rather tricky. Here's a link to the main help topic, which then links to all the others that might be useful: ... itions.htm

When you get into using advanced conditions it can be REALLY tricky until you get your head round it. Take a look at this topic for info on advanced conditions: ... ssions.htm

Re: Many conditions

PostPosted: Tue Mar 17, 2020 7:19 am
by JennyLucas
Morning all,

Thanks for your replies guys, but I have read those and other posts and I am still not getting it.
I understand when things get tricky. To be clear, I have taught software development, including SQL Server, for many years.

I'm hoping that someone can point out my problem.
I've tried various includes and excludes and still not getting what I expect. In short, I am trying to understand how Flare does advanced conditionals.

Does anyone use advanced conditionals? Or am I trying to do something that Flare can't do?

Any help is appreciated.

Re: Many conditions

PostPosted: Tue Mar 17, 2020 10:37 am
by ChoccieMuffin
Yes, I use them fairly extensively, and I still have to think really carefully. I have bookmarked that second link because I read it through pretty much every time I need to mess about with conditions in targets.

This is the text from the first WARNING block. (the GUI is different in earlier versions, this is extracted from the 2019r2 help)
"The condition feature is an inclusive system. If you do not select any options at all, all of the tags will automatically be included, as indicated by the gray text in the Action cell. If you include only some tags and exclude others, any remaining tags without options specifically set will automatically be included. However, if you select Include for any of the tags (even just one) and do not select Exclude for any tags, all of the other tags that do not have the Include option set explicitly will automatically be excluded. If you have not explicitly set an option for a condition tag, make sure you look at the gray text in the Action cell to know what will happen for that tag in the output."

1. If you don't set Include or Exclude on any conditions, all of them are included.
2. If you INclude some and EXclude some, any conditions that aren't set either way are INCLUDED.
3. If you INclude some and don't EXclude any, all condidtions not explicitly included are EXCLUDED.
and the extra rule that they didn't state in that warning:
4. If you EXclude some conditions but don't INclude any, where more than one condition is applied to the same bit of content, that content is excluded. In order to INclude a bit of text that has two or more conditions applied to it, you need to explicitly INclude the tag you want.

Usually, in order to avoid confusion in my head, for simple situations (where content only has one condition applied at a time) I only EXCLUDE where possible. But where you have several conditions applied to a single piece of content (as in your example, and in the example from that help page that I quote below) you do need to use both INclude and EXclude. So:

1. If you have two tags applied to a single bit of content and you exclude ONE of the conditions (and don't select INCLUDE on any conditions), that content is excluded.
2. INCLUDE TRUMPS EXCLUDE, so in order to include that middle paragraph (with both conditions applied), you have to explicitly INCLUDE the condition you want to keep.

Back to your issue, the first example on that page explains how things work almost exactly for your example, with the BASIC editor at least.

You have two condition tagsā€”one called "Beginner" and another called "Advanced." Let's say that you have a topic containing three paragraphs. You apply the Advanced tag to the first two paragraphs, and you apply the Beginner tag to the last two paragraphs.

You have created a target called "Advanced Set Up." For this target, you obviously want to include all content associated with the Advanced tag, but you want to exclude content associated with the Beginner tag.

By default, Flare will include content associated with both tags, unless you tell it not to. So you tell Flare to exclude the content associated with the Beginner tag. The problem is the middle paragraph from the topic mentioned above. It is associated with both tags. You have told Flare to exclude content associated with the Beginner tag, and it will do so, overriding the default. But you want to make sure that paragraph is included in the "Advanced Set Up" output. That is why you need to make sure you select the Include option next to the Advanced tag."

(I've been writing this reply all afternoon, so I'll just send this one and will reply about advanced conditions in a separate post.)

Re: Many conditions

PostPosted: Tue Mar 17, 2020 2:32 pm
by SteveS
Have you considered downloading one of the sample projects and looking at the way conditions are used?

Re: Many conditions

PostPosted: Wed Mar 18, 2020 1:08 am
by Dave Lee
I understand up to step (6), but you'd need to give more detail about exactly how you've set up the conditions in the target.
So if you're using Advanced expression, put an example of the expression.

Re: Many conditions

PostPosted: Thu Mar 19, 2020 2:35 pm
by JennyLucas
I connected with support and I think I figured out the issue.

Here's what I learned.
This does in fact work.
include[Set1.A and Set2.A], exclude[Set1.B or Set2.B or Set2.A or Set1.A]

But, not if you use conditional styles.
If you apply the conditions to the elements, then you can do this.
But if you have styles and have the styles set the conditions, then this doesn't work.

So in my earlier example, I had :
{ mc-conditions: 'Set1.A'; }
{ mc-conditions: 'Set1.B'; }

<p class="SET_1_A SET_2_A">stuff</p>
I had to change it to
<p MadCap:conditions="Set2.A,Set1.A">Set 1A + 2A</p>
Then the target with
include[Set1.A and Set2.A], exclude[Set1.B or Set2.B or Set2.A or Set1.A]

Anyone with thoughts about how to get this to work with styles?


Re: Many conditions

PostPosted: Fri Mar 20, 2020 1:06 am
by Dave Lee
If it works when you manually apply conditions, but doesn't work when conditions are set using styles (with mc-condition property), then that doesn't sound good.

At a guess, it might not support two style classes applied to the same tag.

I'd report this back to MadCap support, so they can confirm it's either a bug, or that they don't support this scenario.

Re: Many conditions

PostPosted: Mon Jan 11, 2021 4:03 pm
by davidoliver
I think this might help. I will re-read the if/then logic. However, I have noticed when I set the "include" or "exclude" checkbox and click OK when there are more than 2 conditions, the settings are not saved in MadCap:conditions.
When I open the .htm file in a text editor I see MadCap:conditions="Default.PrintOnly,Default.Online,Default.C2_Only" where I also have a condition checked (then unchecked) labeled "Default.NoBingo". My conditions needed are
Printed Output 1:
PrintOnly - include
NoBingo - exclude
C2_Only - include
Printed Output 2:
PrintOnly - include
NoBingo - include
C2_Only - exclude

I'm wondering about manually adding this "Default.NoBingo" condition via a text editor.
My assumption is my version of Flare isn't robust enough to handle several include/exclude conditions.
I am using MadCap Flare v11.1.2 from 12/11/2015 and there is no chance for upgrading.

Re: Many conditions

PostPosted: Thu Jan 14, 2021 6:00 am
by ChoccieMuffin
davidoliver wrote:...
My assumption is my version of Flare isn't robust enough to handle several include/exclude conditions.
I am using MadCap Flare v11.1.2 from 12/11/2015 and there is no chance for upgrading.

I think there's your problem - I don't think your version was able to apply conditions via a style, I believe it came in two or three versions ago. Shame you can't upgrade, there are lots of really neat features in later versions.