Can you use MadCap Variables in the ConditionTagExpression?

This forum is for all Flare issues not related to any of the other categories.
Post Reply
ClanMoffat
Propeller Head
Posts: 17
Joined: Thu Jun 22, 2023 2:34 am

Can you use MadCap Variables in the ConditionTagExpression?

Post by ClanMoffat »

Hi!

I am working on projects that have multiple "pseudo parameters" that impact selection of the target file and consequently affect the conditions included or excluded....

I see that the Target file can handle the use of MadCap Variables, for example, in the CatapultTarget tags, I have the line:

Code: Select all

OutputFile="[%=Doc-Vars.DocOutputName%]_[%=Doc-Vars.DocVersion%]"
It would be helpful to be able to use MadCap Variables in the ConditionTagExpression attribute, for example:

Code: Select all

ConditionTagExpression="[%=IP-Conditions.Expression%]"
However, whenever I try to build the target with a variable in the ConditionTagExpression attribute, I get the following error:

Code: Select all

[i]Error validating conditional expression: Unrecognized tag: [%=IP-Conditions.Expression%][/i]
:?:
Has anyone managed to succeed with a build when the ConditionTagExpression attribute contains reference(s) to MadCap Variables?
Is this even possible?

:?: :?:
If not possible, why would you code MadCap to support variables in parts of the Target file, but not others...


Thanks!!!
AlexFox
Sr. Propeller Head
Posts: 265
Joined: Thu Oct 19, 2017 1:56 am

Re: Can you use MadCap Variables in the ConditionTagExpression?

Post by AlexFox »

Yeah you can't do this. I can see how it would be useful and I have been frustrated by ConditionalText many times over the years. There is even a paid third-party solution designed for bulk creation of targets based on different conditional expressions: https://www.tbro.dk/

I do wish the advanced conditional expressions were a little bit smarter and that nested conditions were treated a little differently, such as in CSS e.g. a condition tag on an element has a higher priority than a condition tag on the document etc, but alas.
ClanMoffat
Propeller Head
Posts: 17
Joined: Thu Jun 22, 2023 2:34 am

Re: Can you use MadCap Variables in the ConditionTagExpression?

Post by ClanMoffat »

Hi AlexFox!

I've had an initial look at Target Control (https://www.tbro.dk/), but using Variables inside the ConditionTagExpression would have simplified things a lot!

We currently would only need to modify the ConditionTagExpression, so Target Control might be a touch excessive...
I might have to have a quiet word with our special developer and see if he could implement some code to generate the Target files internally...

Thanks!
robdocsmith
Sr. Propeller Head
Posts: 271
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Can you use MadCap Variables in the ConditionTagExpression?

Post by robdocsmith »

Certainly it's straightforward to have a script external to Flare to create targets. I do this and create my bespoke targets programmatically using Python. The structure of a target file is fairly simple. Or you could create a template target file with a string inside for each variable you want to change, then do a find and replace in your favourite text editor swapping these text strings for the variables you want to use, then save it in your targets folder with the filename you need.

Cheers,
Rob
Post Reply