Is there any way to display context depending on the value of a variable?
P.
Conditional text based on variables?
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: Conditional text based on variables?
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 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Re: Conditional text based on variables?
Hi there,ChoccieMuffin wrote:Could you give a bit more context please? I'm not quite sure what you're trying to achieve.
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.
-
- Sr. Propeller Head
- Posts: 248
- Joined: Thu May 24, 2018 3:11 pm
- Location: Queensland, Australia
Re: Conditional text based on variables?
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
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