Topic Conditions

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Rainer Oehry
Posts: 102
Joined: Sun Dec 10, 2017 12:47 pm

Topic Conditions

Unread post by Rainer Oehry »

HI Tim,

the answer will probably be "no", but I'll ask anyway:

Is there a way to apply topic-specific conditions, as it is possible for topic variables?

I have several tables, that I use as snippets, and where I apply individual content to some of the cells, based on the topic they are used in. The cells that should hold individual content contain a variable that is used as topic variable. This works great (one of the strengths of H&M).

I run into problems, though, if I need to include or exclude entire rows or columns, which would be possible if I could set topic-specific conditions/include options. I could put a condition into a whole row or column and then set this condition "True" or "False" individually for each topic.

Or is there another trick to do that?

Thank you.
Regards,

Rainer
Head of Technical Writing & Knowledge Management
TIG Technische Informationssysteme GmbH, Rankweil, Austria
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Topic Conditions

Unread post by Tim Green »

Hi Rainer,

You can use conditional text tags for entire table rows and columns. This is explained here:

https://helpandmanual.com/help/index.ht ... tables.htm
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Rainer Oehry
Posts: 102
Joined: Sun Dec 10, 2017 12:47 pm

Re: Topic Conditions

Unread post by Rainer Oehry »

Thank you, Tim, I am aware of that and would like to use this very feature.

What I need is the ability to set the conditions True or False for individual topics and not just for the whole publishing task.

I can select the Include options for each publishing task, but then the selected condition is True or False everywhere. I need the possibility to select the Include options for each topic individually, not just for the publishing task in total. This would allow me to have a "conditional" row in a table that I use as a snippet in several topics, and then switch this row on or off by (un)selecting the include option for the respective topic, making the condition True (or not) and having the row included (or not).
Regards,

Rainer
Head of Technical Writing & Knowledge Management
TIG Technische Informationssysteme GmbH, Rankweil, Austria
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Topic Conditions

Unread post by Tim Green »

Rainer Oehry wrote:What I need is the ability to set the conditions True or False for individual topics and not just for the whole publishing task.
Ah, now I understand what you mean. I'm afraid that's not possible. The include option conditions are set globally when you publish. They can't be set on a per-topic basis like topic variables, and you can't use topic variables to set them. I'm afraid there's no way to achieve that. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Rainer Oehry
Posts: 102
Joined: Sun Dec 10, 2017 12:47 pm

Re: Topic Conditions

Unread post by Rainer Oehry »

Thank you, Tim, this is the answer I was anticipating, but it's unfortunate nevertheless.

I use various "snippet" tables with content that is common to several "topic" tables. I then combine those tables with individual additional rows into other "snippet" topics (I "glue" them together), and then, in each final "content" topic, I use the appropriate snippet that contains the common content and the required additional rows. This is a bit complicated, but manageable.

The most serious problem arises whenever such a combined table goes beyond one page — I have less control over the page break position, and I cannot have the top row repeat automatically on the next page, because the top row on the first page is not in the table that is split onto the second page.

Can I suggest "topic conditions" according to "topic variables" as an item for the wish list? Not sure, though, whether this is "over the top" with regard to the "internals" of H&M … Or am I again the only one who works like that?
Regards,

Rainer
Head of Technical Writing & Knowledge Management
TIG Technische Informationssysteme GmbH, Rankweil, Austria
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Topic Conditions

Unread post by Martin Wynne »

I run into problems, though, if I need to include or exclude entire rows or columns
Hi Rainer,

Is this for HTML or PDF output?

If you are interested only in HTML, you can do most things with a bit of scripting, inserted using the HTML Code Object function, or via the topic template.

For example, if you had a topic variable which sets the content of a cell to an arbitrary flag string, say something like %:% , you could test for its presence and switch off every row which contains such a cell.

To do that you would insert something like this at the bottom of the topic pages:

Code: Select all

<script>
  var i;
  var v = document.getElementsByTagName('td');
  for(i=0; i<v.length; i++)
  {
    if ( v[i].innerHTML.indexOf('%:%') != -1 ) v[i].parentNode.style.display='none';
  }
</script>
That works for the native H&M output. It might need changing for some of the more complex skins if they do stuff in the onload event. Tim?

You could do something similar for columns, if every cell in the column contains a flag from a topic variable, say %@! for columns:

Code: Select all

<script>
  var i;
  var v = document.getElementsByTagName('td');
  for(i=0; i<v.length; i++)
  {
    if ( v[i].innerHTML.indexOf('%@!') != -1 ) v[i].style.display='none';
  }
</script>
Using additional flag strings you could do more complex switching on and off of different elements, change the colour of rows and columns, or whatever you want. If you leave the element visible, obviously the script needs to strip out the flag string(s) from the page when all done.

Unfortunately there is nothing like this available if you want PDF output.

cheers,

Martin.
Rainer Oehry
Posts: 102
Joined: Sun Dec 10, 2017 12:47 pm

Re: Topic Conditions

Unread post by Rainer Oehry »

Thank you very much for your input, Martin.

On the other hand, my "standard" method works fine enough, and in HTML I do not face the problem with page break control anyway, and there is no need to repeat the header row on the next page either. These difficulties exist particularly with the pdf output, where this kind of scripting trick does not work …

Maybe I'll give it a try anyway. At the least, scripts look "cool" in the editor … 8)

Have a nice weekend!
Regards,

Rainer
Head of Technical Writing & Knowledge Management
TIG Technische Informationssysteme GmbH, Rankweil, Austria
Post Reply