Page 1 of 1

Can you use MadCap Variables in the ConditionTagExpression?

Posted: Fri May 31, 2024 5:23 am
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!!!

Re: Can you use MadCap Variables in the ConditionTagExpression?

Posted: Fri May 31, 2024 7:25 am
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.

Re: Can you use MadCap Variables in the ConditionTagExpression?

Posted: Fri May 31, 2024 8:26 am
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!

Re: Can you use MadCap Variables in the ConditionTagExpression?

Posted: Sun Jun 02, 2024 3:09 pm
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