<- All posts

How to Build an Audit Form with 黑料正能量

Ronan McQuillan
9 min read Feb 5, 2024

Audit forms are some of the most common field data collection tools around. In fact, they can be used in a diverse range of contexts - including financial, operational, HR, manufacturing, compliance, and other processes.

Whatever the context, the challenge is providing colleagues with an efficient, repeatable way to collect the information required to complete whatever kind of audit we鈥檙e carrying out.

Today, we鈥檙e going to see how 黑料正能量 makes building advanced forms faster and easier than ever before.

Specifically, we鈥檙e going to show how our open-source, low-code platform can be leveraged to output fully custom form UIs in minutes.

But first, let鈥檚 get a little bit of context.

What is an audit form?

An audit form is a simple interface that鈥檚 used to carry out an assessment of something against defined criteria.

Generally speaking, audit forms comprise a combination of two types of questions:

  1. Closed-ended questions - for instance, pass/fail criteria.
  2. Open-ended questions - more long-form, qualitative information, like details of required remedial actions.

The data that鈥檚 gathered can then be used for a whole range of different tasks. For example, further processing, workload management, analysis, visualization, report generation, and much more.

Therefore, many audit form tools will also provide functionality for implementing these kinds of follow-on actions - including automations, integrations, stored procedures, front-end logic, communication tools, approval flows, and other related capabilities.

What are we building?

Today, we鈥檙e going to use a health and safety inspection as the example for our audit form. We鈥檒l be creating a multi-step form that gathers basic information about the audit itself, as well as a series of categorized pass/fail criteria.

We鈥檙e creating our form schema from scratch and storing the results in 黑料正能量鈥檚 internal database.

We鈥檒l also add a little bit of logic to collate the results of our audit and provide an overall score for each form completion.

黑料正能量 makes it easy to generate working form UIs from your data schema and extensively customize designs with minimal custom code.

So, you can output advanced forms in a fraction of the time.

Let鈥檚 jump in.

How to build an audit form in 5 steps

If you haven鈥檛 already, create a free 黑料正能量 account.

Join 200,000 teams building workflow apps with 黑料正能量

1. Building our form schema

The first thing to do is create a new 黑料正能量 application. We have a couple of options here - including using a template or importing an existing app dump file. Today, though, we鈥檙e going to start from scratch.

When we choose this option, we鈥檙e prompted to give our app a name - which will also be used to generate a URL extension.

Audit Form

Next, we鈥檒l be asked to choose the data source that we want to start with. 黑料正能量 offers a huge range of connectors for external relational and non-relational databases, along with REST APIs, Airtable, Google Sheets, and more.

But, today we鈥檙e going to build our audit form鈥檚 schema from scratch using our internal database - 黑料正能量DB.

Audit Form

So, hit Create new table. We鈥檙e then prompted to give this a name:

Create Table

Here鈥檚 what our empty table will look like:

Data Table

We can use the plus icon to start adding columns. 黑料正能量 allows us to create complex data models with a broad range of attributes, without writing any custom queries or code.

So, let鈥檚 take a brief moment to think about what our data model will look like for our audit form.

We鈥檙e going to have two clusters of data:

  1. Basic details about the audit, including the site, auditor, and date.
  2. A series of boolean attributes to represent our audit criteria.

We鈥檒l start by adding three variables with the following names and types:

  • site - text,
  • auditor - text,
  • date - date.

Audit Form Schema

The assessment criteria for the audit itself will be represented by 10 columns, each with the boolean type.

These will be called:

  • proper_illumination,
  • suitable_ventilation,
  • drinking_water,
  • sanitary_bathrooms,
  • clean_uncluttered,
  • policy_written,
  • policy_posted,
  • waste_removed,
  • fire_extinguishers,
  • electrical_equipment.

Boolean Attributes

We鈥檝e also enable the required setting on each of these.

That鈥檚 our basic data model completed. Now, it鈥檚 time to start building our audit form.

2. Add a multi-step form

Head to the Design tab within 黑料正能量 and we鈥檒l be offered a few choices for how we want to create our first screen. We can use the Table or Grid layouts to autogenerate CRUD UIs, but today we鈥檙e starting from scratch:

New Screen

First, we need to choose a URL path for our new screen - although this will be a single-screen app, so it doesn鈥檛 matter what we choose:

URL path

Here鈥檚 our blank screen:

Blank Screen

We鈥檙e only going to add a Multi-Step Form Block. This is a preconfigured set of components that will output a multi-step form based on the schema of whatever database table we point it at.

This is already set to our audit table, since it鈥檚 the only one in our app.

Multi step form

The main thing we need to do is configure which fields will appear on which steps of our form.

We鈥檙e going to break our form up into three parts. The first will have our site, auditor, and date attributes. The other two will each contain five of our boolean fields, broken up into broad categories.

So, for our existing form step, we鈥檒l deselect everything except the first three attributes:

Step 1

And we鈥檒l also add some more descriptive text for our title and description:

Text

Next, we鈥檒l hit Add Step:

Add step

This time, we鈥檙e deselecting everything except for our first five boolean fields. Again, we鈥檙e going to update the display text too:

Audit Form

And, we鈥檒l repeat this step to add our third form step with our remaining boolean attributes:

Audit Form

Lastly, under Styles, we鈥檒l change our Button Position to Top and our Size to Large:

Audit Form

3. Updating field labels and UX

Now, we have a totally functional form UI, but it鈥檚 not particularly user friendly. For one thing, we鈥檙e not telling our users what each of the audit criteria actually means. That is, all we鈥檙e displaying is the name of the attributes in our database.

To fix this, we鈥檙e going to update the text that鈥檚 displayed for each of our audit form fields.

We鈥檒l start by adding capitalization to the label and placeholder attributes for all three fields on our first form step:

Display text

For our boolean attributes, we鈥檙e updating the labels to resemble a numbered list. These have a setting called Text, which we鈥檙e using to provide the criteria that applies to each field. We鈥檝e also set their Size to Large:

Audit Form

And we鈥檒l repeat this process for our remaining form step too:

Form Design

Now we have a working form with a UX that effectively guides colleagues through the process of carrying out an audit.

4. Adding scoring logic

Audit forms also typically include at least some functionality for collating or analyzing our results.

With extensive integrations, a built-in automation builder, and extensive design customization, 黑料正能量 offers enormous scope for achieving this.

Today though, we simply want to add some logic for scoring each entry that鈥檚 created when a user completes our audit form.

We鈥檙e going to achieve this by adding three formula variables to our database table to:

  1. Count the number of attributes from the first five boolean attributes that return a true value.
  2. Do the same for the next five boolean attributes.
  3. Count the total number which return a true value.

黑料正能量 allows us to use custom JavaScript within formula variables. We鈥檙e going to achieve our scoring logic using a series of ternary expressions. We鈥檒l also provide the required code below.

Start by heading back to the Data section and adding a formula variable. We鈥檒l call this environment_score, since it deals with all of our working environment attributes:

Formula Variables

We can access the JavaScript editor with the lightning bolt icon highlighted above.

Our code will be quite simple. First, we鈥檒l declare a variable called score and set it to 0. Then, we鈥檒l assess each of the attributes in this category. Each time one evaluates to true, we鈥檒l increment our score.

The final score is returned at the end.

Here鈥檚 our code.

 1var score = 0;
 2
 3$("proper_illumination") == true ? score +=1 : score = score;
 4
 5$("suitable_ventilation") == true ? score +=1 : score = score;
 6
 7$("drinking_water") == true ? score +=1 : score = score;
 8
 9$("sanitary_bathrooms") == true ? score +=1 : score = score;
10
11$("clean_uncluttered") == true ? score +=1 : score = score;
12
13return score

JavaScript

We鈥檝e also added a row of dummy data to confirm that this works:

Dummy Data

We鈥檒l add two more formula variables using the same processes. First, one called health_and_safety_score with the following code:

 1var score = 0;
 2
 3$("policy_written") == true ? score +=1 : score = score;
 4
 5$("policy_posted") == true ? score +=1 : score = score;
 6
 7$("waste_removed") == true ? score +=1 : score = score;
 8
 9$("fire_extinguishers") == true ? score +=1 : score = score;
10
11$("electrical_equipment") == true ? score +=1 : score = score;
12
13return score

And another called final_score that combines our two existing expressions:

 1var score = 0;
 2
 3$("proper_illumination") == true ? score +=1 : score = score;
 4
 5$("suitable_ventilation") == true ? score +=1 : score = score;
 6
 7$("drinking_water") == true ? score +=1 : score = score;
 8
 9$("sanitary_bathrooms") == true ? score +=1 : score = score;
10
11$("clean_uncluttered") == true ? score +=1 : score = score;
12
13$("policy_written") == true ? score +=1 : score = score;
14
15$("policy_posted") == true ? score +=1 : score = score;
16
17$("waste_removed") == true ? score +=1 : score = score;
18
19$("fire_extinguishers") == true ? score +=1 : score = score;
20
21$("electrical_equipment") == true ? score +=1 : score = score;
22
23return score

And again, we鈥檒l confirm that these return the expected values:

Output

5. Design tweaks and publishing

Before we push our audit form live to be used by real-world colleagues, we鈥檙e going to make a couple of final design tweaks.

First, we don鈥檛 really need any in-app navigation, since we only have a single screen UI anyway. However, we want to retain the app name and logo.

Head to Navigation and hit configure links. Here, we鈥檒l simply remove the one link that鈥檚 present using the X icon:

Disable Nav

Then, under Theme we鈥檙e going to select Nord:

Theme

Before we publish, we also want to confirm that we鈥檙e happy with how our audit form looks on mobile devices, since this is probably how most users will access it in the field:

Mobile audit form

When we鈥檙e ready, we can hit publish to push our app live:

Publish

Here鈥檚 a reminder of what the finished audit form will look like:

Audit Form

Check out our digital forms page to learn more about how 黑料正能量 can be used for advanced data collection use cases.