This Knowledge Base article is relevant for ForNAV Designer version 5.5 and higher.
Until now, it has required some coding in JavaScript to format pairs of captions/values and to hide the caption if the value is blank.
For example, in the ForNAV report pack, the standard footer looked like the following:
[
CompanyInformation.PhoneNo != ” ? CompanyInformation.FieldCaptions.PhoneNo + ‘ : ‘ + CompanyInformation.PhoneNo : null,
CompanyInformation.E_Mail != ” ? CompanyInformation.FieldCaptions.E_Mail + ‘ : ‘ + CompanyInformation.E_Mail : null,
CompanyInformation.HomePage != ” ? CompanyInformation.FieldCaptions.HomePage + ‘ : ‘ + CompanyInformation.HomePage : null,
CompanyInformation.VATRegistrationNo != ” ? CompanyInformation.FieldCaptions.VATRegistrationNo + ‘ : ‘ + CompanyInformation.VATRegistrationNo : null,
CompanyInformation.IBAN != ” ? CompanyInformation.FieldCaptions.IBAN + ‘ : ‘ + CompanyInformation.IBAN : null,
CompanyInformation.SWIFTCode != ” ? CompanyInformation.FieldCaptions.SWIFTCode + ‘ : ‘ + CompanyInformation.SWIFTCode : null
].
filter(function (val) {return val;}).join(‘ | ‘)
To make this more readable and editable, we have introduced the concept of FieldExtensions so the expression can now be written like the following:
var joinFormat = ‘ : ‘;
CurrReport.JoinStrings(‘ | ‘,
CompanyInformation.FieldExtensions.PhoneNo.Format(joinFormat),
CompanyInformation.FieldExtensions.E_Mail.Format(joinFormat),
CompanyInformation.FieldExtensions.HomePage.Format(joinFormat),
CompanyInformation.FieldExtensions.VATRegistrationNo.Format(joinFormat),
CompanyInformation.FieldExtensions.IBAN.Format(joinFormat),
CompanyInformation.FieldExtensions.SWIFTCode.Format(joinFormat))
To support this, the Field List in the ForNAV Designer has a new node:
Dragging in nodes from FieldExtensions creates new controls with the source expression Rec.FieldExtensions.Field that output “<caption>: <value> if the value is not blank, and blank if the value is blank. In addition to this, Rec.FieldExtensions.Field also has the following set of functions and properties:
- Rec.FieldExtensions.Field.Format(<delimiter>) – replaces the “: ” delimiter.
- Rec.FieldExtensions.Field.Format(<delimiter>,<format>) – replaces the “: ” delimiter and formats the value using a .net format string.
- Rec.FieldExtensions.Field.Format(<delimiter>,<format>,<languageId>) – replaces the “: ” delimiter and formats the value using a .net format string and a language ID (lcid).
- Rec.FieldExtensions.Field.HasValue – returns true if the value is not blank.
To help with formatting, you can use a new function: CurrReport.JoinString(<delimiter>, <string>,…). This function automatically compresses the output to remove blank values.
To create parity, Rec.FieldGroups.Field now also has the following Format functions:
- Rec.FieldGroups.Field.Format(<delimiter>) – replaces the new line delimiter.
- Rec.FieldGroups.Field.Format(<delimiter>,<languageId>) – replaces the new line delimiter and formats the address according to a language ID.
The ForNAV Report Pack will be updated in the coming version 5.6 to use these new concepts.