WorkfloPlus Collections

This document outlines the main features of the functionality of the collection in Workfloplus.

The Collections feature allows a user to upload their own custom data sets that can be used to populate step descriptions in Workfloplus.

For example, if you were doing a boiler inspection and required a list of all of the boiler models belonging to a particular boiler brand, you could have a selection step to choose the model of the boiler. The selection step would be populated from a data collection uploaded to the WorkfloPlus server.

When you go to the next step you can have a collections query embedded in the description that, when rendered retrieves all of the details relating to that boiler (based on the value you selected in the previous step) and shows that as a table of data.

Uploading a Data Collection

On the dashboard under the settings page, you will find the “Collections” tab. Here you can add collections into the Workfloplus system. 


To add a collection you press the ‘+’ button and give it a name.

From here you can then see that entry added to the main list from which you can add the data by uploading the .csv file.

A collection is essentially a .csv in the following format:

Firstname,Surname,Age,FavoriteColour

John,Smith,45,Blue 

Jade,Smith,32,Green

The csv’s first row must consist of some header names for the data structure to be valid.


The Dashboard will give you a “CollectionID” which is a crucial field we will need later.

Using a Data Collection Within a Workflow

You will need to create a workflow with steps that can query the collection data. Currently, collection data is only usable in step descriptions. 

Using the Editor desktop app to create a new workflow, you can choose to include collection data in your step descriptions. We use Handlebars.js to achieve this.

The following are the types of collection query that can be added to the step descriptions to retrieve different kinds of data:

1. CollectionQuery (MultipleRows formatted as table)

2. CollectionQueryRaw (Returns Data) *Usable by developers only

3. CollectionQuerySingle (returns 1 row formatted as table)

4. CollectionQueryCount (returns an string int with the count of the rows matching criteria)


Query structure

In order to use any one of these query types the description field must contain an example of the following:

Parameters - CollectionID, Field, SearchValue

E.g. using hardcoded strings

{{CollectionQuery "CollectionID" "Field" "SearchValue"}} 

{{CollectionQuery "5e7dd0794edde50001083b20" "AnimalID" "1"}} 


or

{{{CollectionQuery "CollectionID" "Field" "SearchValue"}}}

{{{CollectionQuery "5e7dd0794edde50001083b20" "AnimalID" "1"}}} 

(can be 2 or 3 braces with HC strings. Has to be 3 when using object notation as below)

E.g. using previous step value (or any object value)

{{{CollectionQuery "5e7dd0794edde50001083b20" "AnimalID" CompletedSteps.28a8b0e8-fac1-4241-82e4-af17aa6be7ca.SingleStep.Value}}}

A full step description would look like this:

Welcome to step 1</br>Below you will see the results from our collection query</br>{{{CollectionQuery "5e7dd0794edde50001083b20" "AnimalID" "1"}}}

Note: the CollectionID shown above is an example only. The Dashboard shows the CollectionID when you go to the Collections menu and click on the correct data collection.

Collections relies on HTML & markdown rendering so html tags will be observed in the formatting and any stray/unintentional spaces, tags or characters will affect the formatting of the description potentially producing undesired results.

Upload

Once the step description has been populated correctly the workflow can be saved and exported to a zip for upload to the dashboard.

Once the job is added to the dashboard it will be accessible from the device. 

Upon startup the device will try and download any new collection data that it doesn’t already have. Given we’ve added a new collection it will try to download this. If for some reason it is unable to do so it will fail silently (although this will be in the log file) and when you come to open the workflow with the collection query in it; all you will see is the message “returned no results”. 

If the collection is large or the network is slow it may be possible to get to the step before the collection download has finished - in which case it would be prudent to wait a few mins and retry the opening of that step again.

A
Alana is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.