Introduction

Reports enable you to transform your raw field data into professional, customizable PDF documents that can be printed, shared, or archived.

Report Templates

Report Templates allow you to customize how your data is displayed when printed. An app can have multiple templates and any active reports are available for selection when printing records from web and mobile. If you haven't created any reports for an app, records will automatically print to the standard system report template. If more than one report is active, printing on the web or generating a report on mobile will present you with a list of report templates to chose from.

Members granted the Manage Apps Role Permission have access to manage reports via the REPORTS button in the app builder.

Report Template ManagerReport Template Manager

Report Template Manager

Basic Report Builder

The Basic Report Builder is available on all Fulcrum plans and can be accessed via the REPORTS button in the app builder. If you have not saved any report templates, records will print to the standard system report template, which includes the following elements:

  • Cover Page with Photo, App Information, Record Metadata, Location Map
  • Header with App Name and Record ID
  • Footer with Organization Name, Image, and Address
  • All visible form fields

The Basic Report Builder allows you to create customized templates where you can explicitly show or hide the standard report elements listed above. You can also set the page size and layout and control which fields should be displayed on the PDF. You can save multiple templates and set them to active to make them available when printing or inactive to remove them from the print list.

Basic Report BuilderBasic Report Builder

Basic Report Builder

Advanced Report Builder

While the Basic Report Builder allows you to customize the standard report template via input controls, the Advanced Report Builder includes full code editor access for complete customization of report templates. Fulcrum's reporting engine provides a templating language, editor, preview generator, and rendering stack.

Report templates are written in standard HTML, JavaScript, and CSS. External resources such as front-end frameworks and JavaScript libraries can be referenced and there are many variables and functions available to pull in organization, form, record, and user information.

Advanced Report BuilderAdvanced Report Builder

Advanced Report Builder

Variables

The variables below can be used in tags to output the values into the template.

Example outputting the form name into an H1 heading element:

<h1><%= form.name %></h1>

Organization

  • organization.id
  • organization.image
  • organization.name
  • organization.description
  • organization.address1
  • organization.address2
  • organization.city
  • organization.state
  • organization.postalCode
  • organization.country

Form

  • form.id
  • form.name
  • form.description
  • form.version
  • form.createdAt
  • form.updatedAt
  • form.image
  • form.imageLarge
  • form.imageSmall
  • form.imageThumbnail
  • form.isProjectEnabled
  • form.isAssignmentEnabled
  • form.isAutoAssign
  • form.isGeometryEnabled
  • form.isGeometryRequired
  • form.isHiddenOnDashboard
  • form.boundingBox
  • form.statusField.isHidden
  • form.statusField.isReadOnly
  • form.statusField.isEnabled
  • form.statusField.choices

Record

  • record.id
  • record.version
  • record.latitude
  • record.longitude
  • record.createdAt (server)
  • record.updatedAt (server)
  • record.clientCreatedAt (mobile)
  • record.clientUpdatedAt (mobile)
  • record.createdByID
  • record.createdByName
  • record.updatedByID
  • record.updatedByName
  • record.projectID
  • record.projectName
  • record.assignedToID
  • record.assignedToName
  • record.status
  • record.horizontalAccuracy
  • record.verticalAccuracy
  • record.altitude
  • record.speed
  • record.course
  • record.changesetID
  • record.createdDuration
  • record.updatedDuration
  • record.editedDuration
  • record.createdLatitude
  • record.createdLongitude
  • record.createdAltitude
  • record.createdAccuracy
  • record.updatedLatitude
  • record.updatedLongitude
  • record.updatedAltitude
  • record.updatedAccuracy
  • record.displayValue (title)
  • record.isStatusFieldEnabled
  • record.formValues
  • record.formValues.get('key').displayValue
  • record.formValues.find('dataName').displayValue

User

Information on the user running the report.

  • USERFULLNAME()
  • EMAIL()
  • ROLE()
  • TIMEZONE()
  • LANGUAGE()
  • LOCALE()
  • CURRENCYCODE()
  • CURRENCYSYMBOL()
  • COUNTRY()
  • DECIMALSEPARATOR()
  • GROUPINGSEPARATOR()

Functions

API

Make a Fulcrum REST API call

Parameters

path String (required) - API path

options Object - API request options

Returns

String

Examples

API('/choice_lists', {qs: {per_page: 1}})

AUDIOURL

Generate a public audio URL

Parameters

id String (required) - The ID of the audio file

options Object - {version: 'original', expires: null}

Returns

String

Examples

AUDIOURL($my_audio_field[0].audio_id, {version: 'original'})

FORMATDATE

Format date

Parameters

date Date (required) - The date to be formatted

options Object - Intl.DateTimeFormat options

Returns

String

Examples

FORMATDATE(new Date())

GET

Simple HTTP GET, synchronous

Parameters

url String (required) - Request URL

options Object - Request options

Returns

String

Examples

GET('https://jsonplaceholder.typicode.com/posts', {qs: {userId: 1}})

GETBLOB

Simple HTTP GET, returns ArrayBuffer, synchronous

Parameters

url String (required) - Request URL

options Object

Returns

String

Examples

GETBLOB('https://learn.fulcrumapp.com/img/branding/fulcrum-icon.png')

JSONREQUEST

Similar to GET but auto parses JSON

Parameters

options Object - Request options

Returns

String

Examples

JSONREQUEST({url: 'https://jsonplaceholder.typicode.com/posts', qs: {userId: 1}})

LOG

Log something, appears in the output of reports for debugging

Parameters

string String (required) - The thing to log

Returns

String

Examples

LOG('Hello World')

PHOTOURL

Generate a public photo URL

Parameters

id String (required) - The ID of the photo

options Object - {version: 'large', expires: null}

Returns

String

Examples

PHOTOURL($my_photo_field[0].photo_id, {version: 'thumb'})

QS

Generate a query string from an object (no need to string concat)

Parameters

object Object (required) - The parts of the query string

Returns

String

Examples

QS({name: "Robert", age: "20"}

// name=Robert&age=20

QUERY

Run a SQL query on the Query API

Parameters

sql String (required) - SQL query

options Object

Returns

String

Examples

QUERY('SELECT name FROM forms', {format: 'json'})

QUERYVALUE

Run a SQL query on the Query API and return the first column of the first row (or null). Simple helper for returning scalar values.

Parameters

sql String (required) - SQL query

Returns

String

Examples

QUERYVALUE(`SELECT form_id FROM forms WHERE name = '${form.name}'`)

RENDERVALUES

Recurse the form values to render dynamic reports

Parameters

feature Number (required) - The number of which to return the absolute value.

options Object - Rendering options ({recurseSections: true, recurseRepeatables: true}).

eachFunction Function(element, value) (required) - The render function for each element.

Returns

JSON - the feature elements and values

Examples

<% RENDERVALUES(record, null, function(element, value) { %>
  <% if (element.isSectionElement) { %>
    <h1 class="field-section"><%= element.label %></h1>
  <% } else if (element.isRepeatableElement) { %>
    <% if (value.length) { %>
      <h1 class='field-section'><%= element.label %> <%= value && `(${value.displayValue})` %></h1>
    <% } else { %>
      <h1 class="field-section"><%= value && value.displayValue %></h1>
      <% } %>
  <% } else if (element.isPhotoElement) { %>
    <div class="field">
      <h2 class="field-label"><%= element.label %></h2>
      <div class="field-value">
        <% value && value.items.forEach((item, index) => { %>
          <img class="photo" src="<%= PHOTOURL(item.mediaID) %>" />
          <% if (item.caption) { %>
            <p><%= item.caption %></p>
          <% } %>
        <% }); %>
      </div>
    </div>
  <% } else if (element.isSignatureElement) { %>
    <div class="field">
      <h2 class="field-label"><%= element.label %></h2>
      <% if (value && !value.isEmpty) { %>
        <div class="field-value">
          <img class="signature" src="<%= SIGNATUREURL(value.id) %>" />
          <% if (value.timestamp) { %>
            <p><%= element.agreementText %></p>
            <p>Signed <%= FORMATDATE(value.timestamp) %></p>
          <% } %>
        </div>
      <% } %>
    </div>
  <% } else if (element.isRecordLinkElement) { %>
    <div class="field"> 
      <h2 class="field-label"><%= element.label %></h2>
      <% if (value && !value.isEmpty) { %>
        <div class="field-value"><%= value.items.map(item => item.displayValue).join(', ') %></div>
      <% } %>
    </div>
  <% } else { %>
    <div class="field">
      <h2 class="field-label"><%= element.label %></h2>
      <div class="field-value pre"><%= value && value.displayValue %></div>
    </div>
  <% } %>
<% }) %>

SIGNATUREURL

Generate a public signature URL

Parameters

id String (required) - The ID of the signature file

options Object - {version: 'original', expires: null}

Returns

String

Examples

SIGNATUREURL($my_signature_field.signature_id, {version: 'original'})

STATICMAP

Generate a Google Static Map

Parameters

options object (required) - Google Static Maps API options {center, zoom, size, scale, format, maptype, markers, path}

Returns

String

Examples

STATICMAP({markers: '34.052230,-118.243680', maptype: 'hybrid', size: '300x300'})
<img src="<%= STATICMAP({markers: '34.052230,-118.243680', maptype: 'hybrid', size: '300x300'}) %>" />

TOJSON

JSON.stringify helper

Parameters

json JSON object (required)

Returns

String

Examples

TOJSON(API('/choice_lists').choice_lists[0].name)

VIDEOURL

Generate a public video URL

Parameters

id String (required) - The ID of the video file

options Object - {version: 'original', expires: null}

Returns

String

Examples

VIDEOURL($my_video_field[0].video_id, {version: 'original'})

EJS Tags

Fulcrum's reporting engine uses the (EJS) templating language.

  • <% 'Scriptlet' tag, for control-flow, no output
  • <%_ ‘Whitespace Slurping’ Scriptlet tag, strips all whitespace before it
  • <%= Outputs the value into the template (HTML escaped)
  • <%- Outputs the unescaped value into the template
  • <%# Comment tag, no execution, no output
  • <%% Outputs a literal '<%'
  • %> Plain ending tag
  • -%> Trim-mode ('newline slurp') tag, trims following newline
  • _%> ‘Whitespace Slurping’ ending tag, removes all whitespace after it

Did this page help you?