Condition error in row

Example Clause: # 1028697
Hi everyone,

I am using @cycle to show a currency in 1 of 4 possible variants: manual, manual-pl, auto or auto-pl. This determines if the number is calculated automatically by C9 or overwritten manually by the user, with the option to mark the result as a placeholder:

SUM = @cycle(#shares^total-capital-method, “manual”, @MANUAL, “manual-pl”, @MANUAL-PL, “auto”, @AUTO, “auto-pl”, @AUTO-PL, “”, @EMPTY)
MANUAL = @if(#shares^total-capital-after-increase, #shares^total-capital-after-increase, @EMPTY)
MANUAL-PL = @#LL @MANUAL @#RR
AUTO = @if(#shares^initial-capital AND #shares^increased-capital, @CALC, @CALC-PL)
CALC = {#shares^initial-capital + #shares^increased-capital}

Creating an overview table, I want to show a certain row only when #shares^total-capital-method = “auto” OR “auto-pl”. I tried the following:

|| Title || Data || {@if(#shares^total-capital-method = “auto”) OR @if(#shares^total-capital-method = “auto-pl”)}

I also tried

|| Title || Data || {@if(#shares^total-capital-method = “auto”)

In both cases, I get
image

Does row conditionality only work for true/false-datafields?

Thanks!

Hi Kai,

No, row conditionality works for any type of datafield / condition.

The reason your condition is currently not working is the use of the @if special function inside the condition. The @if special function requires three arguments: the expression which it should check, then the resulting value if the expression evaluates to true and finally the resulting value if the expression evaluates to false, e.g. @if(#shares^total-capital-method = "auto", true, false) for one of your examples.

However, while there are good use cases of the @if special functions (e.g. where you want to write a short, sweet and simple condition without the use of accolades), its use here is not recommended.

You can drop it altogether and just use a normal row condition. Row conditions are very similar to normal conditions, they just do not require you to put any resulting value. E.g.:

|| Title ||  Data || {(#shares^total-capital-method = “auto”) OR (#shares^total-capital-method = “auto-pl”)}

|| Title ||  Data || {#shares^total-capital-method = “auto”}

I just wanted to add that using @if as part of the arguments that a “normal” Clause9 condition should check is in fact not useful in any case. The @if special function works as an alternative to a normal Clause9 condition - i.e. it uses a test to display some result. To demonstrate, the following are equivalent in terms of functionality:

@if(#shares^total-capital-method = "auto", "Total capital method is auto.", "Total capital method is not auto")

And

{#shares^total-capital-method = "auto": Total capital method is auto | else: Total capital method is not auto.}

You could theoretically use it as a way of testing a conditional expression and then making @if result in either true or false (as I did in my example in the previous post) but in that case just using the conditional expression is shorter, simpler and therefore less error prone.

1 Like