In the previous tutorials, we created a workbook to check building safety standards and upgraded it to include a follow-up field for recording details of safety violations. However, there may be cases where you need to repeat a specific section of questions, or even whole chapters or checklists. For instance, in our building inspection workbook, you may need to check the safety standards for multiple floors, rooms or areas.
This is where repeatable sections come in handy. In this guide, we'll explore how to create and use repeatable sections in iCL Designer to make inspections even more efficient and thorough.
Add a repeatable headline
Using this workbook you can check whether a whole building is safe or not. Wouldn't it be better to go into more detail and inspect each floor separately?
We will create a workbook which allows you to specify which building you inspect and then you can check the floors one after another.
To achieve that, first of all we need a new text field where you can tell which floor you are inspecting. Also, do not forget to rename the question from 'Is the building safe?' to 'Is the floor safe?'.
Now let's make the second headline repeatable. You can find a property called 'Is Repeatable' in the headline's Properties menu, click it. It will cause many new properties to show up. Read more about them here.
Clicking 'Is Repeatable' will allow us to add this headline in iCL Filler as many times as we want. You can maximize the occurrences by setting the 'Maximum' property.
Let's also click on 'Can duplicate'. This will let us duplicate a headline.
The difference between repeat and duplicate is that when duplicating a headline, we will also duplicate the given answers along with the questions.
Learn more about duplicating headlines, chapters, whole checklists or even whole inspections in our guide about this topic here.
Save the workbook, upload the new version to iCL Portal and let's see how it looks like in iCL Filler.
Repeat a headline
Once you upgraded an open inspection or started a new one with the latest version of the workbook, you will see the following:
After the first headline with the 2 questions you're already familiar with, a second headline appeared with a + icon on the right hand side. This indicates that the headline can be repeated. Click the second instance of the 'Check' headline to repeat its questions. Now you can inspect the building floor by floor.
Duplicate a headline
Let's imagine the following scenario: you are inspecting a building that has 3 floors. You have already checked the ground floor and first floor and noticed the stairs have no handrail (as you can see on the screenshot above). Moving up to the top floor, you find the same problem for the stairs leading to the 3rd floor.
In this case, duplicating the headline is a great idea as you don't have to enter the same description again.
After that, you just need to change the name of the floor from 'First floor' to 'Second floor' and that's it.
While this example may seem trivial, imagine a more extensive check that involves adding a lot of fields over and over again. In such case, cloning/duplicating can be a real time saver!
Expand and collapse headlines
A checklist can easily get huge with repeatable sections, e.g. just imagine a building with 15 floors, that would result in a rather long checklist in our example.
To make it easier to navigate between headlines, you can collapse them using the arrow icon on the right. To collapse/expand all headlines, use the double arrow icon on the top bar.
However, when the headlines are collapsed, they cannot be distinguished. It would be much better if you could tell which headline belongs to which floor, wouldn't it? To overcome this problem, we need to get familiar with scripts.
Create your first script
Let's jump back to iCL Designer and improve our workbook a little more.
We want to achieve the following: rename the headline (that is currently called 'Check') dynamically using the value of the 'floor' field. To do something like that, iCL Designer offers Blockly scripts.
Blockly scripts allow you to change values, titles or other properties of fields dynamically during an inspection. Furthermore, they also allow you to use the value of another field.
You can open the Blockly editor to create a script by clicking the puzzle icon in iCL Designer. We want to create a script for the title of the second headline, so we have to click the puzzle icon next to its title.
Let's create a script that returns the value of the 'floor' field for each headline. All you have to do is drag the border of the 'floor' field and drop it into the Blockly editor.
Save the workbook, upload it and go back to iCL Filler.
You can download this improved icl file from here.
Check it in iCL Filler
After synchronizing, upgrade the ongoing inspection. Then you should see the following:
Cool, isn't it?
If you now add a new headline, you can see that the title remains "Check" until you fill the 'Floor' question.
In this tutorial, we explored how to create and use repeatable sections in iCL Designer. We learned how to add a repeatable headline, and then how to repeat, duplicate or delete it in iCL Filler.
We also learned how to create a script to rename the headline dynamically. To learn more about Blockly scripts, read the guide: Working with Blockly scripts.