Defining Variables for Topics - Can I Do This?

This forum is for all Flare issues not related to any of the other categories.
Post Reply
Marc
Propeller Head
Posts: 28
Joined: Thu Aug 23, 2007 8:36 am
Location: Malvern, PA

Defining Variables for Topics - Can I Do This?

Post by Marc »

Is there any way to assign a value to a variable for each topic?

For example, suppose I need the following lead-in for three different topics:

Topic1: Use the Post Customer Finance Charge screen to post customer finance charge entries.
Topic2: Use the Post Time & Material Invoices screen to post time & material invoice entries.
Topic3: Use the Post Cash Receipts screen to post cash receipt entries.

(Thrilling? Not really, but it's a living!)

I currently use the System.Title variable for the screen, which lets me create my text as follows:

Topic1: Use the <MadCap:variable name="System.Title" /> screen to post journal entries.
Topic2: Use the <MadCap:variable name="System.Title" /> screen to post time & material invoice entries.
Topic3: Use the <MadCap:variable name="System.Title" /> screen to post cash receipt entries.

I wish there were a way to that I could create a single snippet, like this:

Snippet: Use the <MadCap:variable name="System.Title" /> screen to <MadCap:variable name="MyVariables.Function" />.

and then define the MyVariables.Function variable for each topic.

I don't see a way to do this. Is it possible in Flare? Is it possible at all (that is, is my desire worthy of an enhancement request)?
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

You actually CAN do this using snippets. This is what snippet conditions are for, and I do almost the exact same thing in my project.

Here is what you do:
  1. In the Project Organizer, right-click on the Conditional Text folder, and select Add Condition Tag Set...
  2. Create individual conditions for each variation. (Here you just name the variation so you can recognize it easily later. this isn't actually the text you want to appear in the topic. Its just the name of the condition.)
  3. Save the condition tag set.
  4. From the Project menu, select Add Snippet...
  5. Give the snippet a name and save it. The snippet will open.
  6. Write the text of your topic as you want it to appear. Every time there is a difference (like the screen name or whatever), select the text that is specific to that topic/subject, and from the Format menu, select Conditions. (Be careful about spacing here; it's easy to accidentally include the space in the condition tag for one condition but not all, then you get your conditional text running into your regular text in the output.)
  7. Select the condition tag set you just created, and then select the condition you want to apply to this chunk of text.
  8. Repeat the last two steps to account for all the variations.
  9. Open the topic where you want the snippet to appear, then import the snippet.
  10. Right-click on the topic in the Content Explorer and select Properties.
  11. Go to the Snippet Conditions tab.
  12. Include the condition(s) that apply to this topic, and exclude the condition(s) that don't apply to this topic.
  13. Repeat the last four steps for all topics that should contain the snippet you created above.
I hope I wasn't too hasty here, and I hope you can follow the directions. If you need additional help, be sure to post back here, or you can check the Flare help system for Snippet Conditions. I'd be more verbose, but I AM at my real job, you know, working. :lol:
Paul Pehrson
My Blog

Image
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining Variables for Topics - Can I Do This?

Post by LTinker68 »

Or... Create one variable (e.g., prodTitle) and give it any of the values you mention. Then create three targets, one for each version. In each target file, there is a spot where you can specify an override value for that variable. So no matter what value you gave the variable in the project, it'll be overwritten at compile time by the value you specify in the target. Then you build each target.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

I don't think that will work because Marc states that he wants to use similar content in three different topics in the same project. He wants to have three topics in a single target that have all have substantially similar content with a few exceptions. That is the problem that snippet conditions were designed to address. Variables, being target-specific, won't help here, because all three topics would have the same variable definition for a given target.

If I'm wrong, correct me.
Paul Pehrson
My Blog

Image
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining Variables for Topics - Can I Do This?

Post by LTinker68 »

doc_guy wrote:Variables, being target-specific, won't help here, because all three topics would have the same variable definition for a given target.
They'll have the same variable definition if he doesn't override a variable in the target. See the example in this post -> http://forums.madcapsoftware.com/viewto ... orn#p35804.

Note: When you double-click on a variable value in the Target Editor, you have to double-click on the text in that cell, not just anywhere in the cell.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

I'm not trying to be dense here, but I still don't get how variables will help. The OP wants to create one target. In that target, the OP will have three topics that are almost the exact same, but they will have different terminology. I don't see how you can single source using variables to do that.

In the example you gave, you are still talking about multiple targets and setting the variable in the target (so if the target is chicken, the meat variable changes to chicken). Variables won't work that way if all you want is a single target, right?

Using the OP's explanation, I can't see a way to make it work using variables--which is why snippet conditions were created--there wasn't a way to do what the OP wanted to do until MadCap added snippet conditions in Flare 3.

Like I say, I'm not trying to be dense. If you can see how to make the OP's example work with variables and a single target, can you explain?
Paul Pehrson
My Blog

Image
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining Variables for Topics - Can I Do This?

Post by LTinker68 »

Option one is to create three variables (instead of using the system title variable), give those variables different values, create three corresponding conditional tags, create a snippet, insert all three variables in the snippet, apply the appropriate condition to its corresponding variable, then insert the snippet in each and every topic (and possibly multiple instances in the same topic) where one of those three variables is to be used.

Option two is to create one variable (not the system variable) and give it a default value, insert that variable any place where one of those titles is to be used, create three targets, set the variable's value in each of those targets to the corresponding value.

I get what you're saying, though -- some topics may use one title but not the others, so that the final output could have a mix of titles throughout. I either missed reading that point or I just assumed he was going to have three different outputs, depending on who the audience was. If that's the case, then either of the above options would work. If he does want a mix of titles in the same output, then the conditions in the snippet is the only way to go.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Defining Variables for Topics - Can I Do This?

Post by Andrew »

doc_guy wrote:You actually CAN do this using snippets. This is what snippet conditions are for, and I do almost the exact same thing in my project.

Here is what you do:
I don't really understand why snippet conditions are controlled at the topic level. Why not at the snippet level (if necessary, in addition to the topic level)? In other words, when I insert a snippet into a topic, if it contains variables, I want to somehow have the option of selecting the condition when I insert the snippet. The current method seems unnecessarily complicated, requiring far too much extra clicking.

Give me what I want, where I want it. ;)
Flare v6.1 | Capture 4.0.0
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

I think it is because variables are designed to only have one definition per variable per target. If you were to have variable definitions set for individual snippets, plus variable definitions set for topics, plus the standard variable definition, it becomes awfully complicated to figure out why a certain variable appears in a given location. Is it set at the snippet level? Or is it set in the target? or is it set in the variable definition? What happens when the target file overrides the variable you've set in the snippet?

I think the solution you propose is just as complicated, and leaves at least as much room for error as does the current solution, which I actually quite like.
Paul Pehrson
My Blog

Image
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Defining Variables for Topics - Can I Do This?

Post by Andrew »

Sorry, my apologies; my brain went faster than my fingers. Occupational hazard. :wink:

I meant:
In other words, when I insert a snippet into a topic, if it contains conditions, I want to somehow have the option of selecting which condition when I insert the snippet.
So in my mind, the big point is about when I can select which condition is applied (if it could only apply a condition to the topic at time of snippet insertion, rather than applying to the snippet itself, I could live with that). So the process is something like "insert > snippet, select your snippet, and select appropriate condition(s)" all from the same dialog.

That seems like it would flow much more quickly than "insert > snippet, select your snippet...oh yeah, then go and change the Topic-level properties separately...just have to find the topic in the Content Explorer (sometimes this is easy, sometimes it's *not*), press F4, select Snippet Conditions, and THEN select my condition."

Oh, and I can only do that at the topic level, so if I want to use a snippet multiple times in one topic with different conditions, I'm out of luck.
Flare v6.1 | Capture 4.0.0
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

That I totally agree with.

Let's add a feature request:

https://www.madcapsoftware.com/bugs/submit.aspx
Paul Pehrson
My Blog

Image
Marc
Propeller Head
Posts: 28
Joined: Thu Aug 23, 2007 8:36 am
Location: Malvern, PA

Re: Defining Variables for Topics - Can I Do This?

Post by Marc »

Thank you all for your ideas and the lively discussion. I considered using Paul's snippet condition solution, which is a good idea on a small scale, but I had so many variations that my snippet became unwieldy. I eventually created a generic snippet as a base, inserted it, converted it to text, made my changes manually, and moved on to the next one. (With my apologies to the gods of single-sourcing. As long as nothing in the doc for these screens never ever changes, I'm OK. If it does, serves me right, I guess.)

Andrew's suggestions started to approach what I'm looking for, though. I'm still curious if -- from an XHTML POV -- it is actually possible to define a variable on a topic level (regardless of whether I'm using a snippet). Again, the best example of this that I can provide is the System.Title variable. I can set a value for this variable using <Title> tags above my topic body. For the situation defined in OP, I'd like to create something like a System.Function variable that, like the System.Title variable, I could define in each topic. Flare doesn't let me add any system variables in either the Variable Set Editor or the Text Editor, so I'm feeling like there's no way to do this.
Last edited by Marc on Thu Aug 07, 2008 6:07 pm, edited 1 time in total.
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Defining Variables for Topics - Can I Do This?

Post by doc_guy »

There is no functionality in Flare to support this workflow. If you know enough, you might be able to hack the Flare source files, which I've been able to do on occasion, but it is totally unsupported and it may totally screw up your version of Flare, and who knows what it might do to your project. So, if you proceed with this path, do so with extreme caution.
Paul Pehrson
My Blog

Image
Post Reply