Cross-reference to another (conditional) sub-clause

We received the following question from one of our clients and thought the answer might be useful for other members of the forum too:

I am trying to create a cross-reference to another (conditional) sub-clause. In the code snippet below, you can see that in sub-clause 5, I referred to sub-clause 3.4 using the §3.4 cross-referencing method.

image

However, in the document preview on the left, an error message shows up saying that the target was not found (see screenshot below). How do I fix this?

image

The first thing that you might want to check is the condition in sub-clause 3.4. It might be that the “independent-contractor” datafield is not enabled. Thus, if the “independent-contractor” datafield is not enabled, the entire sub-clause 3.4 will not be present in the document. For that reason, the cross-reference also does not work.

However, this problem can be fixed by adding an additional condition to sub-clause 5.

{#management-committee^exception = true AND #project-manager^independent-contractor = true: Except as provided in §4.3 or as}

Essentially, this will have the effect of only showing the text if both of the conditions are fulfilled. So, only if the “exception” datafield is enabled and the “independent contractor” datafield is enabled. More information on combining conditions can be found here.