 DJacques
		
			DJacques
		
		
		
		
		
		
		
		
	
			05-16-2023 03:56 PM
Hi,
So I've got a simple formula like that:
Call Calculate("ch(""result"")=IIF(ch(""Xpct"")<50,0,ch(""Y"")/(ch(""Xpct"")/100))")
The Xpct channel can and will have values at exact zero. This is the reason I use the IIF condition: when Xpct is below 50%, I would like to have the resulting channel to be at zero.
As it turns out, the resulting channel still has NoValues when Xpct is at zero, see screenshot.
Is it normal? What should I do to avoid that?
Problem reproduced on DIAdem 2017 and 2020. We are in the process of installing and evaluating DIAdem 2023, but that takes time. And I don't think it will solve this "feature".
Thanks,
Jacques
Solved! Go to Solution.
 gsklyr
		
			gsklyr
		
		
		
		
		
		
		
		
	
			05-17-2023 09:46 AM
If you have like "25" in Xpct it will produce 0. My guess it runs both calculations and combines them based on your criteria, but when it is zero, you end up dividing by zero, and any combination will result in NoValue
ch(""Y"")/(ch(""Xpct"")/100) = 1/0/100 = NoValueyou can run this right after:
Call ChnNovHandle("[1]/result", "[1]/result", "SetValue", "XY", True, True, 0)05-19-2023 03:27 AM
Thanks for the reply! I thought about using the NoValue handling function, but I was hoping to find a more elegant way, i.e. having the IIF function doing what I would like to do...
Thanks!
 gsklyr
		
			gsklyr
		
		
		
		
		
		
		
		
	
			05-22-2023 10:16 AM
I have a one line solution, though it involves evaluation a nested IIF so not sure about performance (if that matters):
ch("[1]/result") = IIF(IIF(ch("[1]/Xpct")=0,1,ch("[1]/Xpct"))<50,0,ch("[1]/Y")/IIF(ch("[1]/Xpct")=0,1,ch("[1]/Xpct")/100))