Conditional text based on variables?

This forum is for Single-Sourcing your Flare content to multiple outputs.

Conditional text based on variables?

Postby oceanclub on Mon Feb 11, 2019 5:37 am

Is there any way to display context depending on the value of a variable?

P.
oceanclub
Sr. Propeller Head
 
Posts: 174
Joined: Thu Oct 10, 2013 4:45 am

Re: Conditional text based on variables?

Postby ChoccieMuffin on Mon Feb 11, 2019 7:04 am

Could you give a bit more context please? I'm not quite sure what you're trying to achieve.
Started as a newbie with Flare 6.1, now using Flare 2019r1.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2117
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Conditional text based on variables?

Postby oceanclub on Mon Feb 11, 2019 7:19 am

ChoccieMuffin wrote:Could you give a bit more context please? I'm not quite sure what you're trying to achieve.


Hi there,

In this specific version, I have a variable called ElasticsearchVersion, which is the version of ES required by our software.

This works well in our topics: even in, say, links to their website, where I can use the variable in both the text and the URL of the hyperlink.

However in some instances, while my version variable is the major and minor version (ie, 5.2.2), the documentation links on their website include only the major version (ie, 5.2). So I was wondering if I could have multiple URLs, then hide/show them based on the value of the variable. I wanted to avoid having a condition tag for this since it would rarely if ever be used.

P.
oceanclub
Sr. Propeller Head
 
Posts: 174
Joined: Thu Oct 10, 2013 4:45 am

Re: Conditional text based on variables?

Postby robdocsmith on Sun Sep 15, 2019 11:48 pm

Hi,

How about using two variables? One variable for the URL and one for the text. So if a target has the URL defined it gets turned into an appropriate link. If there is no URL defined for the target, just the variable with the text in it is displayed:

Topic contains:
<p>Software version: <a href="[%=Variables.URL%]"><MadCap:variable name="Variables.URL_Display_Text" /></a>.</p>

Target 1 defines
Variables.URL as ""
Variables.URL_Display_Text as "5.2.2"

Target 2 defines
Variables.URL as "http://www.theurllink.com/"
Variables.URL_Display_Text as "5.2"

Only the second target gets the link in the output.... Hmmmm just tested that and both get a link in the output, but only one resolves to an actual link. The other is underlined as per a link but doesn't link anywhere. If you're links aren't styled with underlines you might be able to get away with that...

Cheers,
Rob
robdocsmith
Propeller Head
 
Posts: 24
Joined: Thu May 24, 2018 3:11 pm


Return to Single-Sourcing

Who is online

Users browsing this forum: No registered users and 1 guest