7 Replies Latest reply on Jun 6, 2013 6:24 PM by GlennS_3

# Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END

Hallo,

how it's possible to create member like
IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END

thx a lot
• ###### 1. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
I believe you asking for member formula not member ;)
IF ( "A1" > 0)
"A1" ;
ENDIF;

IF ( "A2" > 0)
"A2" ;
ENDIF;
• ###### 2. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
Yes :)
but the overall affect should be
If A1 > 0 then A1 + If A2 > 0 then A2 + ....

It means A1= 1 and A2 = 2 then 3,
A1 = -1 and A2 = 2 then 2,...

thx
• ###### 3. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
Ok, then it'll be
``````IF (A1 > 0)
A1 + A2 ;
ELSE
A2 ;
ENDIF;``````
Regards

Celvin
http://www.orahyplabs.com
• ###### 4. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
Funny I'm presenting this as part of my thinking outside the box presentation at KScope. As a more generalized formula without if statements you could do

"A1" * ("A1">0) + "a2" * ("A2" >0);
A1> 0 will return 0 if it is 0 or negative and a 1 if positive. Same for the A2 comparison. The only problem with this is you will get zeros back if both are negative. to be more complete you would need to do

"A1" * ("A1">0/("A1">0) + "a2" * ("A2" >0/("A2" >0);

since A1 will be either 0 or 1 you get 1/1 which = 1 or 0/0 which = #missing anything times #missing is #missing
• ###### 5. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
That is a really interesting logic. I wish we had a like button.

Regards

Celvin
http://www.orahyplabs.com
• ###### 6. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
Glenn is there a gain in performance?

Regards

Celvin
http://www.orahyplabs.com
• ###### 7. Re: Member formula IF ( "A1" > 0) THEN "A1" END + IF ( "A2" > 0) THEN "A2" END
There can be a performance gain. IF statements have to cycle through aditional logic but math is fast.