4. Repeating list datafields
Last updated
Last updated
So, if we jump back into our Word document, you can see that the template author has indicated, for the first option for displaying the services in a table format, that an individual table row should be created for each service. For the clause, the alternative setting out the services, an individual clause should be created each time a new service is entered into the document. The way to recreate this in clause base is with the help of repeating list data fields.
Repeating list data fields are essentially the data fields you’ve come to know and love over the course of these past few chapters, but with the added twist that they can be repeated as many times as you like. So, think of a normal date type data field ordinarily in in such a data field you would be able to fill out a single date and that would be it but with the repeating list data fields of the type date you can fill out an infinite virtually infinite amount of dates as you go through a document which of course opens up some neat different options for portraying your document. So, let’s jump back into Clause9 and open up the Services Annex.
What we’ll do first is we will just create these data fields that we were still holding out on. Here we’re going to write #services^names and here we’re going to write #services^description.
💡 Notice how we’re using the plural of the data field. That’s deliberate, that’s a personal trick that I enjoy using to really identify that we’re essentially going to be writing multiple names, multiple descriptions here, and that a repeating list data field is the way to go.
So, the way that you create these types of data fields is very similar to the way that you’ve created other data fields in the past only this time we’re not a text data field. We are creating a repeating list of the type text, so as you can see here, as you hover over this repeating list option, repeating lists are essentially the data fields that you’ve been using for a while now, with that added special element of them being repeating.
So, here we’re just going to create a repeating list names data field and a repeating list descriptions data field both of the text type and as soon as we click “Save” in library you can see that the repeating list data fields are portrayed a little bit differently from normal data fields. Because of their technically more advanced nature, it’s not possible to fill them out in the interactive preview, but you can fill them out in a sort of table format like this or, and that’s maybe even easier, you can go to the data fields menu where you can then create new elements for names and services.
Regular data fields and repeating data fields may be called the same, but are different from one another. Take care which one you choose for your document!
Since the template author asked us to create a table that would repeat individual rows as new elements are added, that’s exactly where repeating list data fields come into play. You can see here, as soon as I add new elements to the names, but the same would go for description. Of course, new rows are added into the table and this is done fully automatically because Clause9 knows that it is creating repeating with data fields and when those repeating list data fields are included in a table, those rows are automatically repeated.
That’s all there is to creating a repeating list data fields in a table, to repeating those individual rows.
It gets a little bit trickier when it comes to using the same kind of logic in clauses and we’ll have a look at that right now. We’ll reuse, for services descriptions, the same repeating list data field that we just created here in the title. We’ll also use the services names type data field that we just created and then the same principles apply.
So, we can go into the data fields menu and we can indicate, for example, that we have one service which is called “marketing” and another service which is called “legal advice” and another one which is called “sales” only this time you’ll note that – yes, the table is repeating each row, but the clause is just enumerating the elements included in the repeating list.
The reason for that is that if you use a repeating list in a table then clause base can comfortably assume that you’re trying to repeat the individual rows of that table. However, if you’re using repeating list data fields in a clause it cannot make that assumption as comfortably because there are many different things that you could be wanting to do with those repeating list data fields. So it’s up to us to really indicate in the clause – “yes, we are trying to repeat those clauses” every single time a new name, for example, for a service is added.
The way that we do that is we select the clause, navigate to the advanced menu and then indicate that we would like to repeat the clause. Now, it’s by default set to show only once, but we can indicate to Clause9 that we would like to have this clause repeat for each specific repeating list data fields that is being filled out, and in our case that’s, for example, going to be the services names data fields.
This means that every single time a new names repeating list data field is filled out a new clause will appear. So, every time a new entry is created, a new clause will appear, and you can very clearly see that here we have one clause that says “services marketing”, we have one clause that says “services legal advice”, we have a third clause that says “services sales”. The individual elements that you can see here for the descriptions also match the levels for those individual elements for the name. Right now here the marketing is our first element, so if we add a description, called “alpha” for example, it will be attached to this first element in services names. If we create a second element for the services description, it will be matched to the second element in the names, which is of course legal advice. And finally, if we do the same here for the third element, then it’s going to be attached to that third element.
✅ That’s essentially all there is to using repeating list data fields in document assembly mode.
❗️In a later chapter we’re also going to take a look at how they operate in a Q&A type setting.
⏭ The only thing that is left for us to do is to amend this final paragraph a little bit because we don’t want to repeat it every single time along with the individual clauses. That’s going to be the topic of the next chapter!
For more information on some of the topics discussed in this chapter, make sure to check out: