Oct 03, 2021 06:45 PM
Sorry I dont understand formula. Iam using 2 row for my stock, first row is (Stock-DO), Second is IF({Stock}<0,‘ :x: ’,IF({Stok}=0,‘ :heavy_minus_sign: ’,{Stock}))
I DO belive there is a better solution.
So how to express Switch((Stock-DO),Stock<0,‘ :x: ’,Stock=0,‘ :heavy_minus_sign: ’,Stock>0,‘Stock’)
Oct 04, 2021 09:00 AM
This is actually a case where a nested IF() is more suited than SWITCH(). SWITCH statements compare definite answers so Stock < 0
would be evaluated to either true or false, so unless the output of {StockDO}
is a true/false field (like a checkbox), this setup will not work for you.
Your best bet is the formula you already have, probably, with (presumed) typos fixed.
IF({Stock}<0,":x:",IF({Stock}=0,":heavy_minus_sign:",{Stock}))
Hopefully you mean columns. Comparing rows with formulas is not possible unless the rows are linked together.
Oct 04, 2021 12:43 PM
the goal can be achieved using binary logic, like
SWITCH(
({Stock}=0)-({Stock}<0)
,1,‘ :heavy_minus_sign: ’
,-1,‘ :x: ’
,0,{Stock}
)
but that’s more complex and not needed in that case,
while nested IF is simple and obvious.
Oct 06, 2021 12:02 AM
thanks for the answer i just wanna know is there alternative, instead making a lot unique column