Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
Established Member.. raymond.doty
Established Member..
511 views

Report templates or report fields (such as header/footer/title/subtitle) having if statements

I am creating template standards for our reports.  So far i have laid out the following that work pretty well:

~Header:
Time Report Generated:$CurrentDateTime
Report Time Zone:$Custom.Time_Zone
Report Time Period: Start $Custom.Start_Time - End $Custom.End_Time


~Footer:
Report Name:$ReportName | Report Run As: $Run_as_User
Disclaimer:$AccessDisclaimer |  Page: $CurrentPageNumber of $TotalPageNumber

The problem is in the way i would like some items to be presented, be blank if the variables are empty or equal a specific default value.  It looks as though the reports use velocity templates, but i cant seem to make velocity if statements work.

http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#conditionals

For instance in the sub-title i am attempting to include custom parameters:

Custom Parameters --
Username1:$Custom.UserName1 | Username2:$Custom.UserName2

BUT, if someone leaves Custom.Username2 blank, i would like that to just disappear.  Whenever i put in if statements to test, it just prints them out.

example: #if("Username1:" && $Custom.UserName1="Username1:") #{else}Username1:$Custom.UserName1 | #{end}

Has anyone gotten this to work?

Labels (1)
0 Likes
Reply
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.