Two @msword-pages in the same clause cannot call the same @SNIP (Unknown error in syntax)

Hello everyone!

I have an Annex that I attach using @msword-pages which has two variants (Advisory Board with or without Observer Members).

I decided to upload the variants as two separate .docx files, because it was faster than writing a bunch of conditions for minor text changes.

I then use a true/false datafield to call the version with (“yes”) or without (“no”) Observer Members:

image

Now, I want to include the same @SNIPPET in each of the two documents, as the information is identical. When I try to include @COMPANY in both @msword-pages functions, I get a syntax error and am unable to save the clause:

The below clause should reproduce the error:

@if(#ia^has-rop-advisory, @BOARD, @empty-list)
BOARD = @if(#ia^has-rop-advisory-observers = true, @OBSERVER, @ROPA)
OBSERVER = @msword-pages(#rop-a-yes-observer-v4, @COMPANY)
ROPA = @msword-pages(#rop-a-no-observer-v4, @COMPANY)
COMPANY = @if(#company^name, #company^name, @placeholder(“●”)

Interestingly, the error even appears when calling the same @msword-pages document, not two different ones. Maybe the issue lies with @msword-pages wanting unique internal snippets within a clause?

image

The error persists if the two @msword-pages first call different internal snippets, but then both land on the same one:

image

However, using the @if function first, and then sending them to the same internal snippet does work:

image

I can work around this by creating two separate clauses for the two different word fragments.

Hi Kai,

Interesting issue. I have been able to reproduce this, but only when using the @if special function. When writing “traditional” Clause9 conditions, using the same snippet twice works without issue.

E.g. the following does seem to work just fine:

{#ia^has-rop-advisory: {#ia^has-rop-advisory-observers: @msword-pages(#rop-a-yes-observer-v4, @COMPANY) | else: @msword-pages(#rop-a-no-observer-v4, @COMPANY)}}

COMPANY = @if(#company^name, #company^name, @placeholder("●"))
1 Like

One further tip: some of the uses you make of @if can be further simplified by using @cascade. @cascade checks all of its arguments in order of appearance and outputs the first argument that is not equal to nothing (i.e. false, 0, empty datafield,…) and if all of its arguments equal nothing, it will just result in nothing.

E.g. @if(#company^name, #company^name, @COMPANY-PL) could be simplified to @cascade(#company^name, @COMPANY-PL).

1 Like

Absolutely @robbert.jacobs !

I only started using @cascade more recently, so I still forget about it sometimes. Thanks :slight_smile:

1 Like