Set condition of ONE variable

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Matze
Sr. Propeller Head
Posts: 163
Joined: Mon Jun 20, 2016 10:35 pm

Set condition of ONE variable

Post by Matze »

Hi all,
how can I define a condition for ONE variable in a variable set. The whole set works fine but not a variable inside of the variable set.
Its important becaue I´ve some snippets AND variables for the next release, they should not published at the moment.

Example:
"Tighten the screw with a tightening torque of" ---> This is the inline snippet.
"50 Ncm" ---> This is the variable.

The complete sentence is "Tighten the screw with a tightening torque of 50 Ncm".

The "50 Ncm" variable needs also the do not publish condition like the snippet / rest of the sentence.
RStreets
Propeller Head
Posts: 63
Joined: Wed Apr 19, 2017 8:37 am
Location: Cambridge, UK

Re: Set condition of ONE variable

Post by RStreets »

Hi there,

I think you can do this--actually in more than one way.

Note: I'm assuming that you're relying on conditions on the snippet file (set from the Content Explorer) to make the snippet appear/not appear rather than conditioning an inserted snippet inside the topic. I'm further assuming that you don't want to go into the topic file(s) and manually select every instance of the variable to tag with the "do not include" tag.

So, two suggestions:

A. Put the variable inside the snippet and use a snippet variable to set its content when you insert the snippet. Will mean reorganising your variables to be variable definitions, so may not be appropriate.

B. Slightly more fiddly. You could define a style for the variable itself with a condition associated with it.
This works best if you last viewed your stylesheet in Advanced view.
  1. In the VariableSet Editor, select the variable and choose Edit Variable Style.
  2. In the Stylesheet editor, you'll have a new variable style appear for editing.
  3. Scroll down the list of properties until you find the Unclassified section and within it mc-conditions.
  4. Set the condition there for the variable and when you exclude that condition in your build, the variable won't display.
I think this solves the problem.
Rae
Rae Streets (Flare user since 2017, now on Flare 2023; Central user from 2020)
Matze
Sr. Propeller Head
Posts: 163
Joined: Mon Jun 20, 2016 10:35 pm

Re: Set condition of ONE variable

Post by Matze »

Hi Rae,
many thanks for your answer.

The second idea sounds interesting, I check this. If I understand you right: Making a variable class with mc-condition attribute, right?
Matze
Sr. Propeller Head
Posts: 163
Joined: Mon Jun 20, 2016 10:35 pm

Re: Set condition of ONE variable

Post by Matze »

The benefit is not clear for me.
- The first workaround for nesting a variable into a conditioned snippet sounds to heavy for me. In this case I have to put hundrets of variables into separate snippets.
- The second workaround has no benefit for me because Its the same work: Apply a class to my variable or manually apply a condition to the variable.

What I need is the possibility to apply a condition directly by adding a new variable in the variable window. Maybe it does not work or is a bit tricky for Flare, because its XML in the project folder, I dont now...

Thx
SteveS
Senior Propellus Maximus
Posts: 2087
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Set condition of ONE variable

Post by SteveS »

I think you're missing the point of variables, or at least how I use them. I tend to think of a variable as a project-wide value that remains constant in a project but has a different value in a similar project.

Take your torque figure example where you are trying to insert a changeable value into a snippet. Why? Why not just make several snippets, each with a different torque figure and insert the appropriate snippet as necessary? In one case you are trying to use a different number and in the other a different sentence. In each case, it is a simple click to add it to a topic but individual snippets are not as complicated.

Just food for thought...
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Matze
Sr. Propeller Head
Posts: 163
Joined: Mon Jun 20, 2016 10:35 pm

Re: Set condition of ONE variable

Post by Matze »

Thanks for your answer and you are right.

Nevertheless I need the possibility to change the condition of a variable within the variable editor. Otherwise I have to change the condition state inside of all respective topics, lot of work. Ok, maybe I have some ideas of workarounds like changing it in the source code, but all the workarounds are not nice...
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Set condition of ONE variable

Post by Nita Beck »

I've achieved what I *think* you're after by creating a snippet that holds only the variable, to which I have then applied a condition. That way, I can insert the snippet into topics, rather than inserting the variable into topics and having to conditionalize each of those instances.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Post Reply