RoboHelp Build Expressions

What's covered?

The purpose of this document is not to provide an exhaustive tutorial on boolean expressions, the intention is to provide just a basic explanation to help you understand how to use build tags and build expressions so that your RoboHelp outputs contain what you want.

Introduction

For the purposes of this explanation, the scenario is a project that has topics with various combinations of tags applied. We will focus on just four  topics.

You can download a simple project with these topics and the build tags already set up. Click here. The project was created in RoboHelp 9 so just upgrade it in any later version.

Topic

Tag(s) applied

One

Red

Two

Red and Green

Three

Red, Green and Blue

Four

Orange

Basic Expressions

The simplest way to work in RoboHelp is to think along the lines of what you do NOT want to include.

If you exclude Blue and Orange, RoboHelp will write that as NOT Blue AND NOT Orange, as you can see in the Advanced section.

Regardless of other tags, if a topic has a Blue or an Orange tag, it will not get included.

Advanced Expressions

Sometimes though that can mean having to apply a tag to lots of topics just to be able to include a few, other times you want to include something unless it also has another tag. You may want to include topics with the Red tag but not if they also have the Blue tag.

For this you need to use the Advanced section to define what to include and exclude. Using the Advanced button in the Build Expression dialog, these expressions are written to include topics.

Includes

First let's look at some expressions that only specify what to Include.

Build Expression

Topics published

Logic

Red

One

Two

Three

Topics One, Two and Three are tagged Red so they are included.

Orange is not in the expression so its topics are not included.

Red OR Green

One

Two

Three

Topics One, Two and Three are tagged Red so they are included.

They would also be included because they are tagged Green.

Orange is not in the expression so its topics are not included.

Red OR Green OR Blue

One

Two

Three

Topics One, Two and Three qualify against any of the includes.

Orange is not in the expression so its topics are not included.

Red AND Green

One

Two

Both topics have both of the includes.

Orange is not in the expression so its topics are not included.

Red AND Green AND Blue

Three

Only this topic has all of the includes.

Orange is not in the expression so its topics are not included.

Excludes

Now let's look at Advanced expressions that say what to include and what to exclude.

Let's say you want to include topics with Red and / or Green tags but not if they also have Blue tags. If there were no other tags in the project, you could of course just exclude Blue and Orange. Let's assume there are other tags meaning that way is not an option.

Let's see what to do so that topics tagged Blue and/or Orange are excluded. We have to add more about Red and Green either side of the OR / AND operands.

Red OR Green

Think of the OR as creating two sides of the expression.

Red OR Green indicates that either are to be included (because it is an OR operand) but what if the topics have other tags we don't want. For example we don't want Topic Three because it also has a Blue tag.

Whilst the RoboHelp Advance expression builder does not support brackets, it might assist understanding if we use them here. Think of the expression as

(Red) OR (Green)

We want Red but not if the topic also has a Blue tag and the same for Green. Also remember we do not want Orange. That leads us to this expression.

(Red AND NOT Blue AND NOT Orange) OR (Green AND NOT Blue AND NOT Orange)

Expressed like that it is clearer to understand but we have to remove the brackets to arrive at the expression we want.

Red AND NOT Blue AND NOT Orange OR Green AND NOT Blue AND NOT Orange

In the example we are using, it is not necessary to specify NOT Orange as we happen to know that none of the topics that will be included also have the Orange tag. If they will not be included, then it is not necessary to exclude them. The reason for doing so is that could change at some time in the future.

Red AND NOT Blue OR Green AND NOT Blue - would work in this example but we will stick with the more robust expression below.

Red AND NOT Blue AND NOT Orange OR Green AND NOT Blue AND NOT Orange

 

Topic

Tag(s) applied

Will this topic be published?

One

Red

Yes because it has Red.

Two

Red and Green

Yes because it qualifies against either Red OR Green. Also it does not have any excluded tag.

Three

Red, Green and Blue

No as whilst it qualifies against either Red OR Green, it also has Blue which is excluded.

Four

Orange

No because it does not have Red OR Green.

 

Red AND Green

Following the same principles, the expression becomes

Red AND NOT Blue AND NOT Orange AND Green AND NOT Blue AND NOT Orange

The OR becomes AND so now the topics must have both Red and Green tags

Topic

Tag(s) applied

Will this topic be published?

One

Red

No because it does not have Red AND Green.

Two

Red and Green

Yes. This is the only topic that has the defined tags and does not have any excluded tag.

Three

Red, Green and Blue

No as whilst it has Red and Green, it also has Blue which is excluded.

Four

Orange

No because it does not have Red AND Green.

Untagged Topics

Note that any topic that does not have a tag will be included in the output.

Topic Revisions

 

Date

Changes to this page

03 Feb 2017 Topic reviewed. No changes made. Any screenshots may differ in your version of RoboHelp but the functionality is the same.

21 Jun 2011

New topic.