Else tag

Overview

The else tag adds increased power to the if tag. By default, the if tag has a third part that is understood but not explicitly stated:

You can change this, however. If the if tag condition is not met, you can tell the document template to do something else. To achieve this, you need to use the else tag. For example, the report could insert the text "Outside North America" for cities outside the continent.

Note: An else tag is optional. An else tag can only be used once inside an if tag and is only valid inside an if tag. Be sure it is complete (that is, it contains the final />). In other words, you can have an if tag without an else tag, but you can't have an else tag without an if tag.

Example

Here's a table with an else tag:

Contacts

First Name

Last Name

City

<forEach tag> <out tag>

<out tag>

<if tag> <out tag> <elsetag> Outside North America <endIf tag>

<endforEach tag>

 

 

There are four tags in the city column:

Just as with the If tag, the Else tag has two parts:

And here's the final report:

Contacts

First Name

Last Name

City

Lisa

Harris

Outside North America

En-Jay

Hsu

New York

Tomas

Ramirez

Outside North America

Kamala

Sharma

Outside North America

Learn More

Else Tag Tutorial

About tags

The Tag Editor