This article explains how to format portable view tokens in a portable view template. For more information on how to access portable view template tokens, refer to Portable View Templates - Understanding and Accessing Portable View Tokens. For more general information on portable view templates, refer to Portable View Templates - Overview.
Kahua portable view templates use tokens as placeholders for fields from the selected entity (e.g., a memo, an RFI, a contract), or from the project, partition, or domain you are currently in. For more information on how to access portable view template tokens, refer to Portable View Templates - Understanding and Accessing Portable View Tokens.
There are several different common token formats. The following is an explanation of several of them.
Simple tokens
Simple tokens are not formatted and can be placed in your document as is.
Example:
To insert the project number and project name in your document, copy the tokens to your document.
The tokens [ProjectNumber] - [ProjectName] will appear in the resulting pdf as 1056 - New Warehouse Project.
Examples of other simple tokens from the Common Tokens list are [UserName], [ProjectOwner], [CurrentTime] (note that the output for CurrentTime is the current date and time), and [ProjectStatus].
Attribute Tokens
Attribute tokens are found on the Attribute Tokens tab under Template Tokens. They follow the format of [Attribute(entity.fieldname)]
Example:
[Attribute(RFI.Number)] is the template token for the RFI Number field
Formatted Tokens
You can apply formatting to token values. This can be especially useful for date and time tokens and currency value tokens.
Currency tokens have special format options that allow the number to be written out in words.
- Words or WordsMixedCase - Currency text appears in title case ("Two Hundred Dollars and Zero Cents")
- WordsUpperCase - Currency text appears in upper case ("TWO HUNDRED DOLLARS AND ZERO CENTS")
- WordsLowerCase - Currency text appears in lower case ("two hundred dollars and zero cents")
Example:
[Currency(Source=Attribute,Path=RFI.CostAmount,Format=WordsMixedCase)] where the RFI Cost Amount is $550 would result in Five Hundred and Fifty Dollars and Zero Cents.
Conditional Formatting
Conditional formatting can be applied to tokens. The format to use is as follows, where operator is the condition (e.g. Equals, IsEmpty, IsTrue, etc.) and the optional value is the value being checked:
[IF(Source=Attribute,Path=attribute path,Operator=operator,Value=value)]
[THEN] Content to show if condition met
[ENDTHEN]
[ELSE] Content to show if condition not met
[ENDELSE]
[ENDIF]
The following conditions are allowed:
- Equals
- DoesNotEqual
- Contains
- DoesNotContain
- In
- IsGreaterThan
- IsGreaterThanOrEqualTo
- IsLessThan
- IsLessThanOrEqualTo
- IsEmpty
- IsNotEmpty
- IsNull
- IsNotNull
- IsTrue
- IsFalse
Example:
In the example below, if there is a value in the RFI Response field, the RFI Disclaimer text will appear. If there is no value in the RFI Response field, then nothing will appear.
[IF(Source=Attribute,Path=RFI.Response,Operator=IsNotEmpty)]
[THEN]
[Attribute(RFI.Disclaimer)]
[ENDTHEN]
[ENDIF]