5. Some more special functions
Last updated
Last updated
So, you are already familiar with special functions from a chapter in the previous tutorial series. In this chapter we’re going to look at a few more.
But remember, our goal is not to give you this comprehensive overview of all the available special functions. The idea is to generate a reflex, a sort of instinct where if you say “I need to create special manipulations of the text, I need to create some conditional logic and I'm not quite sure how to do it” - chances are the special functions list is going to be of aid in those scenarios and as a reminder you can very easily access the list of special functions from the grammar sheet itself.
🔗 This link immediately takes you into the list of special functions where you can then scroll and check and see whether there’s anything that can help you there. Obviously, each special function is kind of explained with a few words on how to best use it!
For the first special function that we’re going to be tackling in this chapter, we need to again start exploring this particular paragraph which as you remember from the previous chapter we indicated should not be repeated all this time. Also if we take a look at the source document, you can also see that if we scroll all the way down, the template author has indicated that this clause should only be included if more than one service is assigned or if more than one entry is entered into our repeating list data fields from last chapter.
So, let’s do just that. First of all, we’re going to have to remove this paragraph from the repeated clause because we only want it to appear once so it should fall outside of that repetition. Then, we’re just going to create a new library clause. Obviously we’re going to do that in the services folder. We can call that clause something along the lines of “services not exhaustive” for example. Then we just paste the content body. No need for content title. You can optionally also put this paragraph number correctly, save and insert. We can also, of course, turn the numbering off because that’s how it is portrayed in the base document, and then the idea is to enable or disable this clause depending on the amount of services that have been created.
Anytime you hear the word enable, or just generally being able to activate or deactivate an entire clause, you should be thinking of the enabled menu, which was also addressed in a previous chapter, in the previous tutorial series.
What I’m going to do is write the condition that is going to enable or disable this clause using the special function and then I’ll give a word of explanation of what exactly I just created.
@count
special functionThis is the condition, this is going to enable or disable this paragraph depending on the amount of services that have been identified, and essentially it starts with this special function @count
. What this does is, as usual, you write the name of your special function and then between brackets you write the element that it has its effect on or the parameter that it has its effect on. Here in this particular instance we are saying to Clause9 please count the amount of times that the data field services names has been filled in.
We could have also chosen services descriptions, but since we’re already using that to repeat the clause on right, it makes more sense to just use that one that would also be the most logical field to fill out first is the name of the service. So, we’re telling Clause9 “please count the amount of times that the services names has been filled in” – in other words, how many types of services have been identified and then, if that number is higher than 1, then this clause is going to be enabled. So, we’re going to save that in the library with this condition. Of course, the clause is still being portrayed, but if we go to the data fields menu and we delete two of the services names’ entries, all of a sudden, this clause is deactivated, disabled, because of course there is only one service that is being identified.
That’s our first special function, the @count
special function. If we take another look at the source documents, specifically in article 7 or article 6 rather, you can see that an optional cross reference has been included to article 7 where the template author has also indicated that this cross reference should only be included if the clause in question is used. That makes sense because in the previous tutorial series, you will remember, we created conditional logic with the enabled fields that allows us to deactivate or activate enable or disable the non-compete clause so if we’re going to reference the non-compete clause we need to make sure that it’s actually in the document. So, let’s dive back into Clause9 and take a look at how we can do that.
We’ll go back into the Consultancy Agreement. We will first of all set up the cross reference, the way that we would normally do this.
🔗 The way that we’re going to do this in this particular instance is using a link from the non-compete clause to the concept of non-compete.
Since we already have that concept, makes a lot of sense to quickly create a cross-reference on that basis. As you will remember, and as you can also see here from this cross reference, you would just write the paragraph symbol (§), the non-compete concept and “and” and then we can save that in the library. Naturally, at this point in time, Clause9 is going to give us an error notification because no anchor has really been defined. We’re not referencing anything yet because we haven’t linked a clause to a concept.
So, that’s what we’re going to do just now. We’re going to open up this non-compete clause and establish an outgoing link with the concept of non-compete and as soon as we hit “Save in library” here then you are going to see that we still have that error notification.
Why is that? Well, of course, this clause is currently disabled. The condition that it applies to is currently not activated, so of course Clause9 is going to say “yes, you can see this because you’re the author and you need to know that this clause could potentially be activated” but naturally the cross reference is not going to work, so we’re not going to reference that. For all intents and purposes, this clause is not in the document for this cross reference, so the way that we can solve that is if we activate the condition that enables this non-compete clause. Then you can see that the cross-reference is used.
@implemented
conditional logicNow the only thing that remains to us is to create conditional logic that allows us to hide this cross-reference if the non-complete clause is not in the document and to show it if it is indeed in the document. The special function that we will be using to do that is what we call the @implemented
special function. We’re just going to write the condition in question @implemented(#non-compete): §non-compete
and the word “and” which is also going to be inserted here.
Now, the way that this condition works is essentially we are asking Clause9 is the concept of non-compete implemented anywhere in this document, i.e is there any clause in the document that specifically has that implementation link to the concept of non-compete. If that is the case, then we make the cross-reference to the article containing the non-compete and also the word “and” because we are referring to a second cross-reference right after. Now you can see nothing really changes because our non-compete has already been activated, but if we turn this condition off, if we indicate that the non-compete is not included in the list of optional clauses, then all of a sudden this cross-reference is dropped and those are the two special functions for this chapter.
For more information on some of the topics discussed in this chapter, make sure to check out: