Skip to main content
Version: 2.14.X

Advanced Mapping Guide

Sample Files

Two sample Advanced Collection Builder .docx templates can be found at the following links. Each contains various examples of how a Word template can be formatted to obtain a highly customized collection report export.

  • Sample File 1 shows all the major fields and formats exportable from a collection.
  • Sample File 2 shows how to work with specific helpers to target the export of specific custom fields, events, and data fields.

Syntax Overview

Several basic data fields are easily referenced in the .docx file. Refer to a collection data field in your template by wrapping a data field name with the following syntax:

+++= data-field +++

tip

Include +++= title +++ in your file to export the title of the collection.

Fields with Additional Options

Some data fields have multiple output options to specify. The syntax for these fields is:

+++= data-field.option

tip

To get the createdAt time of a collection, but in local time format, include +++= createdAt.dateTimeLocal +++ in your document.

Working with Loops

Certain data fields in a collection contain multiple elements (such as Participants, Comments, Events). You can loop through any of these elements and selectively output data.

The syntax for a loop is structured as follows. You can name the variable X whatever you like:

tip
+++FOR X IN data_field_that_is_loopable+++    // Starts the loop.

+++= $X.key+++ // Output the data you desire.

+++END-FOR X+++ // Ends the loop.

When using a FOR-loop, do not forget to include the $ sign on the reference item.

tip

Assume we are attempting to loop through the participants in a collection and desire to output each participant's full name and email in a bulleted list. This would look like the following:

+++FOR person IN participants +++

- +++= $person.fullName +++
- +++= $person.email +++

+++END-FOR person +++

Utilizing helper functions and conditionals can also help output specific information that you define (e.g., specific custom fields, event types, or event fields).

Basic Fields

Basic fields are easily mapped using the following syntax:

Data FieldSyntax
title+++= title +++
description+++= description +++
numItems+++= numItems +++
priority+++= priority +++
id+++= id +++

Tags

Tags include some fields with additional options, and can be mapped using the following syntax:

Data FieldLoop Required?Syntax
primaryTag-+++= primaryTag.tagOption +++
additionalTagsYes+++= additionalTags.tagOption +++
additionalTagsList-+++= additionalTagsList +++

When using primaryTag or additonalTags, you must specify a tag option. Replace tagOption with any of the following:

OptionOutput Example
id3741e133-d830-4931-845e-49333b4f519d
nameLE/CI - Complete
color#37e04d
order15
typeSYSTEM
tip

To get the primary tag's name:

+++= primaryTag.name +++

To loop through all additional tags and output the tag name:

+++FOR tag IN additionalTags +++

+++= $tag.name +++

+++END-FOR tag+++

Users

Users include some fields with additional options, and can be mapped using the following syntax:

Data FieldLoop Required?Syntax
createdByUserNo+++= createdByUser.userOption +++
assignedToUserNo+++= assignedToUser.userOption +++
participantsYes+++= participants +++

When using createdByUser,assignedToUser, or participants, you must specify a user option. Replace userOption with any of the following:

OptionOutput ExampleNotes
id70d3d3a6-8c52-4483-8610-e4da9192775cN/A
firstNameJohnN/A
lastNameDoeN/A
email`jdoe@cogility.com``N/A
roleThreat AnalystN/A
fullNameJohn DoeN/A
fullNameAndEmailJohn Doe (`jdoe@cogility.com``)N/A
fullNameAndRoleJohn Doe (Threat Analyst)N/A
groupsGroup One, Group TwoN/A
createdAt.optionDateTimeSee Datetime Fields
deletedAt.optionDateTimeSee Datetime Fields
updatedAt.optionDateTimeSee Datetime Fields
lastLoginAt.optionDateTimeSee Datetime Fields
tip

Get the name of a collection's assigned user and their email in two separate lines.

+++= assignedToUser.fullName +++

+++= assignedToUser.email +++

Loop through all participants and output their full name and last login date in local time (at the time the export was performed):

+++FOR person IN participants +++

+++= $person.fullName +++

+++= $person.lastLoginAt.dateTimeLocal +++

+++END-FOR person+++

Datetime Fields

Datetime fields include some fields with additional options, and can be mapped using the following syntax:

Data FieldLoop Required?Syntax
archivedAtNo+++= archivedAt.dateTimeOption +++
createdAtNo+++= createdAt.dateTimeOption +++
updatedAtNo+++= updatedAt.dateTimeOption +++
deletedAtNo+++= deletedAt.dateTimeOption +++

When using a time-based field like archivedAt, createdAt, updatedAt, or deletedAt, you must specify a datetime option to output a specific datetime format. Replace dateTimeOption with any of the following:

OptionOutput Example
dateTimeLocalOctober 15th, 2022 at 11:06 AM
dateTimeLocalTZOctober 15th, 2022 at 11:06 AM PDT
dateTimeUTCOctober 15th, 2022 at 6:06 PM UTC
dateLocalOctober 15th, 2022
dateLocalTZOctober 15th, 2022 PDT
dateUTCOctober 15th, 2022 UTC
shortLocal10/15/2022
shortLocalTZ10/15/2022 PDT
shortUTC10/15/2022 UTC
isoDate2022-10-15T18:06:55Z
shortLocalTZ10/15/2022 PDT
shortUTC10/15/2022 UTC
isoDate2022-10-15T18:06:55Z
timeLocal11:06 AM
timeLocalTZ11:06 AM PDT
timeUTC11:06 AM UTC
tip

Output a collection's createdAt time in date time local format:

+++= createdAt.dateTimeLocal +++

Custom Fields

Users have the option of:

Regardless of the method used, the following custom field options must be specified to output a specific value.

Custom Field Options

Each Custom Field in Workstation contains the following options that can be output:

OptionOutput ExampleNotes
id34b830b0-ee6b-4646-87a3-cf0d2925fb41N/A
keytoohzxN/A
typeCHECKBOXN/A
nameType of CaseN/A
valueDomestic Violence, BurglaryN/A
values---Helpful for looping through checkboxes for custom formatting.

Referencing Specific Custom Fields

Custom fields do not require a loop if you do not need specific control of the output format.

To reference a custom field:

  1. Find the key for the desired custom field template in Designer > Custom Field Templates in the edit mode for the template.
  2. Reference this key in your doc template with the syntax: +++= customFieldByKey.keyhere.option +++, where `option`` is any of the available custom field options.
tip

Assume there is a Subject SSN custom field with a key of ABCDEF. To output the name and value of this field:

+++= customFieldByKey.ABCDEF.name +++   // Outputs 'Subject SSN'

+++= customFieldByKey.ABCDEF.value +++ // Outputs the value
note

Custom fields of the checkbox type output multiple selections as a concatenated string separated by commas. A loop of custom fields checkboxes is required for more advanced control over data outputs (such as bulleted or numbered lists of checkbox values).

Rich Text Fields

When exporting rich text custom fields, the tool attempts to maintain the format of the rich text content and styling. However, there may be situations in which Microsoft Word overrides specific formatting, such as indentation levels within bulleted and numbered lists or section headers.

Additionally, it is generally recommended to use the _html helper to ensure that the output of the rich text content closely resembles its appears in Workstation.

tip

Output a rich text field using the HTML rendering method (defaults to Arial font and 12pt font size):

+++HTML _html(customFieldByKey.keyhere.value) +++

Looping through Checkboxes

Checkbox custom fields may possess multiple selected options. Looping through a checkbox custom field requires the values option instead of the value.

tip

Assume there is a Case Category Custom Field with a key of ABCDE. To output the name of this field and each applied value as a numbered list:

+++= customFieldByKey.ABCDE.name +++          // Outputs the name "Case Category".

+++ FOR val in customFieldByKey.GHIJK.values // Starts the loop.

1. +++= $val +++ // Outputs the value.

+++END-FOR val+++ // Closes the loop.

Exporting All Custom Fields

If desired, you may choose to output all custom fields in a collection. This is achieved by doing a loop on the customFields data field.

tip

Loop through all custom fields and output their names and values:

+++ FOR field in customFields +++             // Starts the loop.

+++= $field.name +++ // Outputs the field name.

+++HTML _html($field.value) +++ // Outputs the field value and parses HTML (for rich text fields).

+++ END-FOR field +++ // Closes the loop.

If needed, the value of the custom field can also be wrapped in the HTML renderer or the HTML Helper. This is useful for handling rich text custom fields.

Items (Events)

Items are data elements in a collection that represent the events added to a collection. Items can only be accessed with a FOR-loop.

Data FieldOutput ExampleNotes
eventTypeTitleBehavior ProfilesN/A
coreId021a773e-de6e-2029-0a9d-5d528022065aN/A
primaryTitleJohn DoeN/A
createdAtAugust 7th, 2023 at 11:54 AMN/A
updatedAtOctober 24th, 2023 at 11:10 AMN/A
riskScore91N/A
lexiconscompare, financial, bankN/A
eventDetails---Loop within the Items loop. See Event Detail Options
eventTypeTopicbehavior_profilesN/A
eventTypeProjectNameProject Name HereN/A
eventTypeDataSource.id021a773e-de6e-2029-0a9d-5d528022065aN/A
eventTypeDataSource.connectStringkafka.confluent.svc.clusterN/A
eventTypeDataSouce.namedefaultN/A
eventTypeDataSource.typekafkaN/A
tip

Loop through all attached events in a collection and output the event type name, then display the core ID and risk score as a bulleted list:

+++ FOR event in items +++           // Starts the loop.

+++= $event.eventTypeTitle +++ // Outputs the event name.
- +++= $event.coreId +++ // Outputs core ID as a bullet point.
- +++= $event.riskScore +++ // Outputs risk score as a bullet point.

+++END-FOR event +++ // Closes the loop.

Event Detail Options

The eventDetails data fields on Items are also loops. You can access these loop while looping through Items and output any event's detailed fields.

Event Detail FieldOutput
typestring
pathstring
namestring
valuestring
keystring
tip

Loop through all attached events on a collection and output the event type name, then each event detail field's name and value as an indented list:

+++ FOR event in items +++                       // Starts the items loop.

+++= $event.eventTypeTitle +++

+++ FOR field in $event.eventDetails +++ // Starts a second loop in the event details.

- +++= $field.name +++: +++= $field.value +++ // Outputs the bolded field name and value as a bullet point.

+++ END-FOR field +++ // Closes the second event details loop.

+++END-FOR event +++ // Closes the items loop.

Outputting Specific Event Types and Fields

It is possible to identify specific event types to output as well as specific fields in each type of event. This is more advanced, but is possible through several helper functions with a FOR-loop:

  1. Find the key for the desired Event Detail Field.
    1. Navigate to the Admin page of Workstation.
    2. Click the Options button for the desired Event Type and select View Event Definition.
    3. The keys for various data fields and event metadata are shown.
  2. Reference this key in your doc template with the syntax: +++= _get($event, 'eventDetailByKey.keyhere.option') +++:
tip

Assume a collection has numerous types of events added, and you desire to:

  • Only export the Behavior Profiles events.
  • Only output the SSN (key of ABCD) and Description (key of EFGH) fields.
  • Manually show the field names Social Security Number and Short Description.
// Start the loop and only keep Behavior Profile events.

+++FOR events IN _keep(items, ‘eventTypeTitle’, ‘Behavior Profiles’)+++

Social Security Number

+++= _get($events, 'eventDetailByKey.ABCD.value') +++ // Get the SSN data field.

Short Description

+++= _get($events, 'eventDetailByKey.EFGH.value') +++ // Get the Description data field.

+++END-FOR events +++ // Close the loop.

Comments

Comments on a collection can only be accessed with a FOR-loop.

OptionOutputSyntax
idc940f633-2158-487a-a7db-bbab57b7de6e+++= $comment.id +++
contentHTML---+++= $comment.contentHTML +++
contentPlain---+++= $comment.contentPlain +++
createdAtSee Datetime Fields+++= $comment.createdAt.dateTimeOption +++
deletedAtSee Datetime Fields+++= $comment.deletedAt.dateTimeOption +++
updatedAtSee Datetime Fields+++= $comment.updatedAt.dateTimeOption +++
userSee Users+++= $comment.user.userOption +++
repliesLoop-able within commentsSee example below
tip

Output each comment on the collection and include:

  • The user's full name and email.
  • The date and time the comment was created.
  • The comment rendered in plain text format.
  • If there is a reply to a comment, output the:
    • Full name of the reply author.
    • Date and time the reply was made.
    • The content of the reply rendered in plain text format.
+++ FOR comment in comments +++                        // Start the comments loop.

By: +++= $comment.user.fullNameAndEmail +++ // Output name and email of commenter.

Created: +++= $comment.createdAt.dateTimeLocalTZ +++ // Output "Created At" time.

+++= $comment.contentPlain +++ // Output comment content in plain text.

+++ FOR reply in $comment.replies +++ // Start loop for replies

+++= $reply.user.fullName +++ // Output name of reply author

+++= $reply.createdAt.dateTimeLocalTZ +++ // Output date/time reply was made

+++= $reply.contentPlain +++ // Output reply content in plain text.

++ END-FOR reply +++ // Close the reply loop.

+++END-FOR comment+++ // Close the comments loop.

Additional Helpers and Functions

These helper functions provide simple solutions to some fields and options used in advanced collection reports.

_now

A datetime object with the date/time at the moment of report generation. Helpful to track the time that an export is performed. Utilize this with a datetime option. The general syntax is as follows:

+++= _now.dateTimeOption +++

tip

Output the current day (using local time zone) that the export was performed:

+++= _now.shortLocal +++

_html

Allows HTML formatting to be embedded in the document. Useful when outputting custom fields that are rich text or comments. The HTML helper has three possible options to allow more control over the desired output font and font size. The syntax is as follows:

+++HTML _html(value, Desired Font, Desired Font Size ) +++

  • Desired Font is optional. The default is Arial.
  • Desired Font Size is optional. The default is 12pt.
tip

Assume there is a rich text custom field with a key of ABCDE. To output the name of this field and the value in HTML format:

+++HTML _html(customFieldByKey.ABCDE.value) +++

_plain

Exports a value as plain text. Using this with custom fields that are rich text or comments may export and show HTML tags and markdown characters. The syntax is as follows:

+++= _plain(value) +++

tip

Assume there is a rich text custom field with a key of ABCDE. To output the name of this field and the value in plain text format:

+++= _plain(customFieldByKey.ABCDE.value) +++

_get

The _get helper is useful, in combination with the FOR-loop, to grab a specific value with built-in error handling for null or non-existent values. If desired, you can specify the value to return if no value is found. The syntax (within a for-loop) is as follows:

+++= _get($event, 'eventDetailByKey.keyhere.option', Desired Null Value) +++

The Desired Null Value is optional. By default, null values return as N/A.

tip

Assume a collection has numerous types of events added, and you desire to:

  • Only export the Behavior Profiles events.
  • Only output the SSN (key of ABCD) field.
  • Manually show the field name as Social Security Number in bold.
+++FOR events IN _keep(items, ‘eventTypeTitle’, ‘Behavior Profiles’)+++  // Start the loop.

Social Security Number

+++= _get($events, 'eventDetailByKey.ABCD.value') +++ // Get the SSN data field.

+++END-FOR events +++ // Close the loop.

_omit

Filters out items in a list by comparing the values of the given key. Used in a FOR-loop.

The syntax is:

_omit(list, ID, id1, id2, ...)

Where:

  • list is a filterable list (e.g., items, eventDetails, customFields).
  • ID is the field you wish to filter by.
  • id1, id2, etc. are the values to filter by.
tip

Loop through the events (items) in a collection and exclude any event that is under "Behavior Profiles":

+++FOR events IN _omit(items, ‘eventTypeTitle’, ‘Behavior Profiles’)+++  // Start the loop.

Social Security Number

+++= _get($events, 'eventDetailByKey.ABCD.value') +++ // Get the SSN data field.

Short Description

+++= _get($events, 'eventDetailByKey.EFGH.value') +++ // Get the Description data field.

+++END-FOR events +++ // Close the loop.

_keep

Keeps only the items in a list by matching the values of the given key. Used in a FOR-loop.

The syntax of the _keep helper is as follows:

_keep(list, ID, id1, id2, ...)

Where:

  • list is a filterable list (e.g., items, eventDetails, customFields).
  • ID is the field you wish to filter by.
  • id1, id2, etc. are the values to filter by.
tip

Loop through the events (items) on a collection and only include any event that is under "Behavior Profiles":

+++FOR events IN _keep(items, ‘eventTypeTitle’, ‘Behavior Profiles’)+++  // Start the loop.

Social Security Number

+++= _get($events, 'eventDetailByKey.ABCD.value') +++ // Get the SSN data field.

Short Description

+++= _get($events, 'eventDetailByKey.EFGH.value') +++ // Get the Description data field.

+++END-FOR events +++ // Close the loop.