String Concatenation & Font/Size Control

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

String Concatenation & Font/Size Control

Postby » Sat Nov 19, 2022 12:46 pm

I am going insane trying to get a string concatenation to work correctly in my VTL.
What I would like is to be able to assemble a string from a combination of string variables and fixed text strings.
And I would like for the font and size to be controlled by the VTL code - not the documentation or defaultValue properties of the value properties I'm using.

Here are excerpts from is the VTL code that populates the variables used in the assembly of the concatenated string:
#set($Cstatementdocumentation = $attribute.defaultValue.instance.documentation)
#set($REASONVALUE = $attribute.defaultValue.instance.documentation)
#set($referral = $attribute.documentation)
#set($datelittle = $attribute.defaultValue.text)
#set($programofficenamesymbol = $element.documentation)
#set($programofficeaddress = $element.documentation)

Here is the VTL code that assembles the string:
#set($distributionstatementstring = $Cstatementdocumentation + $REASONVALUE + $datelittle + “.” + $referral + $programofficenamesymbol + $programofficeaddress + “.”)

And here is the VTL that displays the string on a title page of a document:

The font and size of the output is mostly correct (Calibri 10), but there are corruptions to the font and size and there is extra stuff that comes in too.
Here is the output document result:

DISTRIBUTION STATEMENT C: Distribution authorized to U.S. Government agencies only; due to
contractor performance evaluation;
DD MMM YYYY (Ex: 31 JAN 2022). p {padding:0px; margin:0px;} Other requests for this document shall be referred to <provide the Organization/Office Symbol (Ex. AFLCMC/EBZE)>; <provide the Program Office Address>..

It's not possible to see this in this forum page, but the portion of this string that comes from the $datelittle variable is all in Times New Roman 12, while the rest is in the desired Calibri 10.
There are also extra CF/LFs which I don't want.
I'm using value properties for most of these variables.
AND - I've tried both the documentation property (with and without using the html editor) and I've used the defaultValue property (which only provides a really simple editor).

One thing I believe to be true: I must use the defaultvalue property IF I want the control of the font and size to be relinquished to the VTL.
Otherwise, it's best to use the documentation property and the html editor - which has it's own drawbacks (namely the insertion of the html characters).

I also believe that all the confusion and corruption in this output string is due to the VTL engine and/or JRE - as even Apache has published that string concatenation in VTL is "tricky".

Does anyone know of the best way to concatenate strings form model elements in a way that puts the control of the font and size in the VTL without corrupting the output string?
Forum Newbie
Forum Newbie
Posts: 12
Posts Rating:1
Joined: Fri Apr 23, 2021 7:12 am

Return to Report Engine

Who is online

Users browsing this forum: No registered users and 1 guest