Conditional row in a table using @assigned

As explained on this help page, I only want to show this conditional row if the fax number is filled out, but the row shows even if the datafield is empty.?

|| #party1^fax || {@assigned(#party1^fax)}

Hi Bernd,

I guess the issue is the subtle distinction between:

  • a text datafield that is assigned an empty value
  • a text datafield that is not assigned any value at all

The condition you used, checks whether something (even an empty value) is assigned. In your case, you should probably have used

|| #party1^fax || {#party1^fax}

This code not only checks whether something is assigned, but (if so) also whether the assigned value actually contains at least one character.

Note: visually, these two situations (assigned an empty value vs. assigned no value at all) will be shown as follows in the data dashboard:
Assigned an empty value
Not assigned any value

Hi Maarten,

Thank you for your reply.

The row still shows in simulate Q&A using

|| #party1^fax || {#party1^fax}

Forgot to mention: {#party1^fax} is actually a shorthand for {#party1^fax != ""} or even {not(#party1^fax) = ""} That last version is longer to type, but probably more readable if you are new to ClauseBase.

Also, @assigned has its uses (it is, for example, a bit generic than a check such as … != "" , which only works for tex data fields), but probably you want to use the latter one in the beginning.

I tried this, but the row is still showing in simulate Q&A?

|| #party1^fax || {not(#party1^fax) = ""}

Could it perhaps be the case that you only adapted the table in one language, and not the other ones? (This is a frequently made mistake…)

Also, just to be clear, the code should be either {not(#party1^fax) = ""} or {#party1^fax != ""} . Sometimes when changing code you inadvertently mix up the two — for example {not(#party1^fax) != ""} , which is a mistake because it is kind of a “double negation” and thus actually boils down to {#party1^fax = ""} , i.e. “the fax number must be empty”.

On a side note, we have now adapted the documentation for @assigned to reflect the explanations above. It is a subtle distinction that is liable to confuse users.

Perhaps the issue is something else. I just made another change to the same clause (ID1000279) but for some reason the new clause (i.e. the latest changes to that clause) doesn’t load in assemble document or design Q&A, regardless of clicking save multiple times.

That’s odd. Can you refresh your browser and try again?

I found the issue. I recently changed the default language of my account and I was not aware that I was editing and English clause and viewing the Dutch version in assemble document, causing the problem obviously. My issues regarding the conditional row is solved, thank you.

1 Like