Else Tag
3 min
the else tag adds increased power to the if tag docid\ fnm83z3 a3nmfu2f8jpis by default, the if tag has a third part that is understood but not explicitly stated if the condition isn't met, do nothing 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 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 the if tag sets the condition the out tag tells the report what to do if the condition is met the else tag tells the report that if the condition set by the if tag isn't met, to do something else in this case, insert the text "outside north america" the endif tag tells the template to stop setting a condition just as with the if tag, the else tag has two parts evaluating if a condition (set by the if tag) isn't met determining what to do if the condition isn't met 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