...
...
...
...
...
...
...
...
...
...
...
...
...
...
Overview
In order to provide the ability to generate highly formatted documents, Windsor has implemented a feature that allows Form Designers to:
...
The following example returns a formatted Submission # and is an example of the syntax for a basic standard data attribute.
<<[submission.formattedNumber]>> |
Formatting a date
The following example returns the date of the submission, formatted as a date as specified.
<<[submissionVersionSubmitted]:”M/d/yyyy h:mm tt”>> |
You can manipulate the format using the following format codes.
Format Code | Meaning |
---|---|
M | Displays one or two digits for the month, as necessary. |
MM | Always displays two digits for the month. |
MMM | The three-letter abbreviation for the month. |
MMMM | The full name of the month. |
d | Displays one or two digits for the day of the month, as necessary. |
dd | Always displays two digits for the day of the month. |
ddd | The three-letter abbreviation for the day of the week. |
dddd | The full name of the day of the week. |
yy | Always displays two digits for the year. |
yyyy | Always displays four digits for the year. |
h | Displays one or two digits for the hour, as necessary on a 12-hour clock. |
hh | Always displays two digits for the hour on a 12-hour clock. |
H | Displays one or two digits for the hour, as necessary on a 24-hour clock. |
HH | Always displays two digits for the hour on a 24-hour clock. |
m | Displays one or two digits for the minutes, as necessary. |
mm | Always displays two digits for the minutes. |
tt | Includes the am/pm designation. |
Some examples
Definition | Sample Result |
”MMMM d, yyyy h:mm tt” | February 20, 2019, 4:03 pm |
”M/d/yyyy HH:mm” | 2/2/2019 16:03 |
”MMM d, yyyy h:mm tt” | Feb 20, 2019, 4:03 pm |
“dddd, MMM d, yyyy h:mm tt” | Wednesday, Feb 20, 2019, 4:12 PM |
Amount Due Example
The following example returns the amount currently due, formatted as a currency.
<<[submission.processingFee + submission.adjustments - submission.onlinePaymentsTotal]:”C”>> |
Dynamic Data Attributes
When accessing dynamic data in the submission (e.g., custom data points defined in form sections by a form designer), there are a few steps that should be followed, such as:
...
In this example, the template is attempting to access text from a Short Text or Paragraph Control, the “Site Name”, that the user entered in the submission. The Short Text or Paragraph (e.g., Site Name) Control in the submission has a Tag value of “SITE_NAME”. The first step is to define the siteName variable. Assuming Site Name control will always be available on the Submissions, use the following syntax to define the siteName control:
<<var [siteName = SectionControls.FirstOrDefault(sc=>sc.tag ==”SITE_NAME”).values.controlValue] >> |
Once defined, siteName can be referenced from anywhere in the template using the following syntax:
Site Name: <<[siteName] :upper>> |
Info |
---|
The “:upper” reference is used to make all text uppercase. |
...
Defines the siteAddressCtrl variable to simplify the many references to this control.
Performs error handling to handle the situation where the site address is null.
The siteAddress variable is established by concatenating all the constituent parts of the address control (e.g., street address, secondary address, city, state, zip, etc.) and to improve formatting. HTML break tags are added where needed.
See example below:
<<var [siteAddressCtrl=SectionControls.FirstOrDefault(sc=>sc.tag ==”ADDRS”)]>> <<var [siteAddress = siteAddressCtrl == null ? “”:”\r”+ siteAddressCtrl.values.street + “\r” + siteAddressCtrl.values.street2 + (siteAddressCtrl.values.street2 != null?“\r”:””) + siteAddressCtrl.values.locality +”,” + siteAddressCtrl.values.areaCode + “ “ + siteAddressCtrl.values.postalCode] >> |
Info |
---|
Each individual address component could be referenced separately (versus one address block, if desired. |
...
One defined, the siteAddress can be referenced from anywhere in the template using the following syntax:
Site Address: <<[siteAddress]:upper:”format” –html >> |
Info |
---|
The “:upper” reference is used to make all text uppercase. The “format” –html reference used to ensure the displayed text honors the HTML formatting tags, in case you would like to use html markup such as “<br />” instead of “\r”, or <strong>, etc. |
...
Defines the submitterCtrl variable so simplify the many references to this control.
Performs error handling to handle the situation where the company name is null.
The submitterInfo variable is established by concatenating some of the constituent parts of the submitter control (e.g., name, street address, secondary address, city, state, zip, etc.) and to improve formatting, HTML break tags are added where needed.
See example below:
<<var [submitterCtrl=SectionControls.FirstOrDefault(sc=>sc.tag ==”CNTCT”)]>> <<var [submitterInfo = submitterCtrl == null ? "":"<br/>"+ submitterCtrl.values.companyNameContact+"<br/>"+ submitterCtrl.values.streetContact + "<br/>" + submitterCtrl.values.street2Contact + (submitterCtrl.values.street2Contact !=null?"<br />":"") + submitterCtrl.values.localityContact +"," + submitterCtrl.values.areaCodeContact + " " + submitterCtrl.values.postalCodeContact]:"format" –html>> |
Info |
---|
Each individual contact component could be referenced separately, versus one address block, if desired. |
Once defined, the submitterInfo can be referenced, in uppercase, from anywhere in the template using the following syntax:
<<[submitterInfo]:upper:”format” –html>> |
Other Considerations
Below are some additional considerations when presenting dynamic data attributes:
When defining the variables for the data to be accessed:
Perform this work at the top of the page (prior to the data attribute being referenced).
Do NOT add carriage returns in or between these definitions as the template will include these carriage returns in the presented document.
If a referenced control in the template does not contain data within the submission, we must trap that to avoid a template failure. To trap for potentially absent data in a control, the following format of code can be used.
<<var [companyNameCtrl = SectionControls.FirstOrDefault(sc=>sc.tag==”COMPANY_NAME”)]>> <<var [companyName= (companyNameCtrl == null ?””: companyNameCtrl.values.controlValue)]>> |
If a Control is empty (e.g., not entered), the value returned to the template will be a blank. In some cases, blank values are saved in controls as a “?” to help with URL encoding. In these cases, the “?” will need to be replaced with a blank value during display.
Case does matter when referencing variables so be sure that your casing is in sync.
Configuration values (in the Vars.config, VarsOverrides.config, etc.) can be exposed to the document generator. These can be exposed by referencing the existing configuration properties in the following format:
<add key="docgen.config.settings" value=" |
Any attributes referenced here can be accessed from within the document by referencing the configuration value without periods and capitalizing secondary words. So, the app.Title configuration setting will be referenced as:
<<[appTitle]>> |
The message.email.appBaseUrl configuration setting will be referenced as:
<<[messageEmailAppBaseUrl]>> |
Internal values can be exposed to the document generator. They can be exposed by referencing the existing internal data element in the following format:
<<var[NewCert=InternalDataControls.FirstOrDefault(sc=>sc.definitionDictionary.tag =="CertNumInitial")]>> |
Once the variable is set you can reference it using the following structure:
Certificate Number: <<[NewCert.values]:upper>> |
Anchor | ||||
---|---|---|---|---|
|
...
User Information:
Name:
Full Name: <<[loggedInUser.displayName]>>
Username: <<[loggedInUser.login]>>
Email: <<[loggedInUser.primaryEmail]>>
Company: <<[loggedInUser.company]>>
Address: <<[loggedInUser.addresses.FirstOrDefault(a => a.addressType.Name =="home")]>> This is not yet available.
...
Submission attributes that are custom to a form or dynamically generated can also be referenced on a template. Control values can be referenced in a format such as below; here Tag Value is the Tag assigned to the control, and Control Type is the control type of the attribute being accessed. Please see the Control Value Properties Appendix within the nFORM Integration Guide for available Control Types that can be referenced for a Control. More properties may be available. Please see the nFORM Control Attributes Reference Guide for guidance if an attribute needed is not referenced.
SectionControls.FirstOrDefault(sc=>sc.tag ==”[Tag Value]”).values.[Control Type]] >> |
The following describe how you would normally reference each control. Your Variable name is set to what you want to name the variable, the tag should be set to the tag within the control you wish to access.
...
Establish Variable Example
<<var [ShortText=SectionControls.FirstOrDefault(sc=>sc.tag ==”STC”).values.controlValue]>> |
Reference Variable Example
Short Text: <<[ShortText]>> |
Paragraph
Establish Variable Example
<<var [Paragraph = SectionControls.FirstOrDefault(sc=>sc.tag ==”PRGRPH”).values.controlValue] >> |
Reference Variable Example
Paragraph: <<[Paragraph]>> |
Instructions
No attributes are returned from this control.
...
Establish Variable Example
<<var [Single=SectionControls.FirstOrDefault(sc=>sc.tag ==”SSC”)]>> |
Reference Variable Example
Selection: <<[Single.values.select]>> Reason: <<[Single.values.otherReason]>> |
Multi Selection
Establish Variable Example
<<var [Multi=SectionControls.FirstOrDefault(sc=>sc.tag ==”MSC”)]>> |
Reference Variable Example
Selection: <<[Multi.values.select.Replace(",",", ")]>> Reason: <<[Multi.values.otherReason]>> |
Formatted
Number
Establish Variable Example
<<var [Number=SectionControls.FirstOrDefault(sc=>sc.tag ==”NMBR”).values.controlValue]>> |
Reference Variable Example
Number: <<[Number]>> |
Date
Establish Variable Example
<<var [Date=SectionControls.FirstOrDefault(sc=>sc.tag ==”DTE”).values.controlValue]>> |
Establish Variable Example
<<var [Email=SectionControls.FirstOrDefault(sc=>sc.tag ==”EML”).values.controlValue]>> |
Reference Variable Example
Email: <<[Email]>> |
URL
Establish Variable Example
<<var [URL=SectionControls.FirstOrDefault(sc=>sc.tag ==”URL”).values.controlValue]>> |
Reference Variable Example
URL: <<[URL]>> |
Phone
Establish Variable Example
<<var [Phone=SectionControls.FirstOrDefault(sc=>sc.tag ==”PHN”).values.controlValue]>> |
Reformatting the input phone number:
<<[Phone.Substring(0,3) + "-" + Phone.Substring(3,3) + "-" + Phone.Substring(6)]>> |
Reference Variable Example
Phone: <<[Phone]>> |
Advanced
Name
Establish Variable Example
<<var [Name=SectionControls.FirstOrDefault(sc=>sc.tag ==”NME”)]>> |
Reference Variable Example
Full Name: <<[Name.values.fullNameValue]>> Title: <<[Name.values.titleValue]>> |
Location
Establish Variable Example
<<var [Location=SectionControls.FirstOrDefault(sc=>sc.tag ==”LCTN”)]>> |
Reference Variable Example
Coordinates: <<[Location.values.mapCoord]>> |
Address
Reference Variable Example
Line by line Address: <<[siteAddress]>> 1st Line of Address: <<[siteAddressCtrl.values.street]>> 2nd Line of Address: <<[siteAddressCtrl.values.street2]>> Location Description: <<[siteAddressCtrl.values.description]>> City: <<[siteAddressCtrl.values.locality]>> State: <<[siteAddressCtrl.values.areaCode]>> Zip: <<[siteAddressCtrl.values.postalCode]>> County: <<[siteAddressCtrl.values.county]>> Country: <<[siteAddressCtrl.values.countryCode]>> |
Attachment
Establish Variable Example
<<var [Attachment=SectionControls.FirstOrDefault(sc=>sc.tag ==”ATTCHMNT”)]>> |
Reference Variable Example
Comment: <<[Attachment.values.attachmentComment]>> Confidential: <<[Attachment.values.confidential]>> Confidential Reason: <<[Attachment.values.confidentialReason]>> File ID: <<[Attachment.values.fileId]>> File Name: <<[Attachment.values.fileName]>> |
Table
Establish Variable Example
var [Table=SectionControls.FirstOrDefault(sc=>sc.tag ==”TBLE”)] |
Advanced Table Example
The following example prints all values of the short text control. The tag for the control in this example is ”Short” while the tag for the advanced table itself is “ADV_TABLE_CONTROL”. The short text value is called on with “<<[shortValue]>>”. <<var[advancedTable=SectionControls.FirstOrDefault(sc=>sc.tag=="ADV_TABLE_CONTROL")]>> <<var[advancedTableRows =advancedTable.rows]>> <<foreach [row in advancedTableRows]>><<var [shortColumn=row.columns.FirstOrDefault(c=>c.tag ==”SHORT”)]>><<var[shortValue =shortColumn== null || shortColumn.values ==null?””:shortColumn.values.controlValue]>> <<[shortValue]>> <</foreach>> |
DataGrid Summary Data
This code iterates through a collection of rows called
|
Contact
Establish Variable Example
<<var [submitterCtrl=SectionControls.FirstOrDefault(sc=>sc.tag ==”CNTCT”)]>> <<var [submitterInfo = submitterCtrl == null ? “”:”<br/>”+ submitterCtrl.values.companyNameContact+”<br/>”+ submitterCtrl.values.streetContact + “<br/>” + submitterCtrl.values.street2Contact + (submitterCtrl.values.street2Contact !=null?”<br/>”:””) + submitterCtrl.values.localityContact +”,” + submitterCtrl.values.areaCodeContact + “ “ + submitterCtrl.values.postalCodeContact] >> |
Reference Variable Example
Line by line Address: <<[submitterInfo]>> Prefix: <<[submitterCtrl.values.prefixNames]>> First Name: <<[submitterCtrl.values.firstNameContact]>> Middle Name: <<[submitterCtrl.values.middleNameContact]>> Last Name: <<[submitterCtrl.values.lastNameContact]>> Title: <<[submitterCtrl.values.titleContact]>> Company Name: <<[submitterCtrl.values.companyNameContact]>> 1st Phone: <<[submitterCtrl.values.phoneContact_0]>> 1st Line of Address: <<[submitterCtrl.values.streetContact]>> 2nd Line of Address: <<[submitterCtrl.values.street2Contact]>> Location Description: <<[submitterCtrl.values.descriptionContact]>> City: <<[submitterCtrl.values.localityContact]>> State: <<[submitterCtrl.values.areaCodeContact]>> Zip: <<[submitterCtrl.values.postalCodeContact]>> County: <<[submitterCtrl.values.countyContact]>> Country: <<[submitterCtrl.values.countryCodeContact]>> |
Hidden Text
Establish Variable Example
<<var [Hidden=SectionControls.FirstOrDefault(sc=>sc.tag ==”HDDN”)]>> |
Reference Variable Example
Hidden: <<[Hidden.values.controlValue]>> |
Calculated
Establish Variable Example
<<var [Calculated=SectionControls.FirstOrDefault(sc=>sc.tag ==”CLCLTD”).values.controlValue]>> |
Reference Variable Example
Calculated: <<[Calculated]>> |
Repeaters
If references to data found within a form repeater are desired, consulting services will be required to perform advanced configuration of the document template. However, an example below could provide insight into the proper syntax depending on experience level:
This example prints values from the text field (highlighted in green) located within the repeater control (highlighted in blue). <<var [repeatSection = submissionVersion.sections.FirstOrDefault(s=>s.tag == "REPEATER" && s.repeatableParentSectionId == Null)]>> <<var [Repeat = submissionVersion.sections.Where(s=>s.id == repeatSection.id || s.repeatableParentSectionId == repeatSection.id).OrderBy(s=>s.sortOrder)]>> <<foreach [item in Repeat]>> <<if [item.Controls.FirstOrDefault(sc =>sc.tag=="REPEAT_TEXT")!= Null]>> <<[item.Controls.FirstOrDefault(sc =>sc.tag=="REPEAT_TEXT").values.controlValue]>> <</if>> <</foreach>> |
Markup
If you are uploading a document that is in review, be sure and turn off track changes before you save it to upload. Markup will be considered part of the document and will impact rendering.