How to condition for "if" statements?

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
plowright
Propeller Head
Posts: 38
Joined: Tue Sep 30, 2014 11:07 am

How to condition for "if" statements?

Post by plowright »

I presume this is possible, and I just haven't figured out the "math" on how to do it. Expert suggestions are welcome. :)

I have content for (let's say) three customers. Some of it is used by all; some of it is used by one or two; and some of it is excluded from all three (future use).

I have multiple versions of software being used: SoftwareVersion1 and SoftwareVersion2.

I would like to condition the final output for Customer1 when SoftwareVersion1 is being used. [If Customer1 is using SoftwareVersion1, display these steps; or, if Customer1 is using SoftwareVersion2, display these steps.]

I feel like it should be easy (include Customer1; exclude SoftwareVersion2), but if something is conditioned for both "Customer1" and "SoftwareVersion2", the steps for SoftwareVersion2 show up when they shouldn't; and if I separate the conditions out "SoftwareVersion1" items appear when they shouldn't for "Customer1".

It seems like I may need to create an "Exclude Customer1" condition for content I don't want included (if this is the case, is it better to create a shared "NotUsed" condition for all three and rely on the "Include" override for Customer1 or create distinct "NotUsed" conditions for each customer?). Or do I have to determine in advance which software version a customer is using and condition for that customer/software version and hope they don't decide to upgrade in the future?

Thanks!
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: How to condition for "if" statements?

Post by NorthEast »

Firstly, if you haven't read about 'advanced' condition tag expressions, see:
http://webhelp.madcapsoftware.com/flare ... ssions.htm

The basic mode is fine if you just want to exclude a few conditions, but I think for your situation the limitations might soon cause a bit of a headache.
In basic mode, you're effectively limited to using 'or' and 'not' operators; e.g. exclude content marked A or B: not (A or B).

When you use 'advanced' option it means you can create more complex expressions, and importantly you can use the 'and' operator to choose content marked with multiple tags; e.g. include content marked A and B (but not A or B individually): A and B.

The expressions you'll need to set up in the target depend entirely on how you apply conditions in the topics. If you haven't already set up the conditions, this is one of those areas where it's really worth spending time to understand what you can do with conditions, and how you plan to use them in your project (now and in the future).
plowright
Propeller Head
Posts: 38
Joined: Tue Sep 30, 2014 11:07 am

Re: How to condition for "if" statements?

Post by plowright »

Thanks, Dave. I read through the advanced section and think I have a slightly better understanding of things, but

I'm bumping into the same thing (I think). I want A included, but I only want B included if A is included. If A is not included, then I don't want B (because it's B is essentially a subsection of A). So if A is included, then B. If no A, then no B. (And B has a counterpart, C, which is excluded from this scenario, but qualifies B's existence.)

[I'm not sure if that made things clearer or more muddled.]
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: How to condition for "if" statements?

Post by NorthEast »

plowright wrote:I'm bumping into the same thing (I think). I want A included, but I only want B included if A is included. If A is not included, then I don't want B (because it's B is essentially a subsection of A)
Assuming that condition B is set on the same element as A (e.g. same paragraph or span tag), then you'd need an expression like:

Code: Select all

Condition.A or (Condition.A and Condition.B)
Which would include anything marked with A alone, or include anything with A and B; but not include anything with B alone.

(Technically, just including Condition.A would do exactly the same thing in this example; but I'm assuming you would also have instances where elements marked with A and another condition are not required.)
plowright
Propeller Head
Posts: 38
Joined: Tue Sep 30, 2014 11:07 am

Re: How to condition for "if" statements?

Post by plowright »

Thanks, Dave. You got me thinking about it in a different way.

"Condition.A" and not ("Condition.A" and "Condition.C") seemed to work (but we decided to go with Snippets instead because the content was frequently repeated).

:)
Post Reply