Goal amount for this year: 3000 USD, Received: 2345 USD (78%)

1. ## Nested Conditional statement

Hi again,

Trying to figure out why this statement wont work
(surely a syntax problem)

If someone can correct this for me I would appreciate it

I am trying to get this formula to say if the angle is greater than 22.5, then report 45. If the angle is less than 67.5 report 45, else report 90. (if true report 45, if false report 90)

IF ( Angle > 22.5 , 45 , 90 , IF ( Angle < 67.5 , 45 , 90 ) )

Revit is giving me an error saying it needs a value if its false but Ive given both replacement values so Im not sure whats going on.
Do I perhaps need to use an IF/AND conditional instead of a nested conditional?

2. Actually think I just answered my own question - this formula works

if(and(Angle > 22.5, Angle < 67.5), 45, 90)

3. Now trying to complicate things by going one step further but having trouble with the OR conditional -

if(and(or(Angle > 22.5°, Angle < 35°, Angle = 30°), or(Angle > 35°, Angle < 67.5° , Angle = 45°), or(Angle < 67.5° , Angle = 45°), or(Angle > 67.5°, Angle < 90° , Angle = 90° )))

IF angle is greater than 22.5 AND less than 35 then angle = 30
OR
IF angle is greater than 35 AND less than 67.5 then angle = 45
OR
IF angle is greater than 67.5 AND less than 90 then angle = 90

Its telling me Im missing the true false conditions, but to me they are implicated in the or statement...how do I get this formula syntax correct?

I also tried these other 2 formulas neither of which have worked.

if(and(or(Angle > 1°, Angle = 30°), or(Angle > 35°, Angle = 45°), or(Angle > 67.5° , Angle = 90°)))

if(and(or(Angle > 1°, 30°, 1), or(Angle > 35°, 45°, 90), or(Angle > 67.5° , 90°,45)))

4. if(and(or(Length A > Length B, Length A = Length B), or(Length A > Length C, Length A = Length C))

This is the "example" given that is supposed to work, and I see no "false" value here. Just if this condition is met, then one result OR the other - there is no such thing as a false result as it has to be one of the or statements....

5. Originally Posted by Karalon10
if(and(or(Length A > Length B, Length A = Length B), or(Length A > Length C, Length A = Length C))

This is the "example" given that is supposed to work, and I see no "false" value here. Just if this condition is met, then one result OR the other - there is no such thing as a false result as it has to be one of the or statements....
I havent deciphered your formula but i can see 4 ( and only 3 )...

6. This statement will work:
if(and(Angle > 22.5°, Angle < 35°), 30°, if(and(Angle > 35°, Angle < 67.5°), 45°, if(and(Angle > 67.5°, Angle < 90°), 90°, 0°)))

You need to provide the result if none of those conditions are true, I just used 0 in this case. The and/or route might be a little more complicated, but for starters your syntax is reversed. You'd need to have or(case 1, case2, case3), with each case being and(condition 1, condition2)
Boolean operators return true/false statements, so you'd still need to translate that to an angle at some point. if you have notepad ++ it helps in organizing these nested formulas.

7. Originally Posted by Karalon10
if(and(or(Length A > Length B, Length A = Length B), or(Length A > Length C, Length A = Length C))

This is the "example" given that is supposed to work, and I see no "false" value here. Just if this condition is met, then one result OR the other - there is no such thing as a false result as it has to be one of the or statements....
The only way that works is if it's a binary condition (yes/no parameter). In that case the if statement is also implied so you'd just start with the and(...
If you want to convert a binary output to a different type of parameter, you need the if statement and a result if true, result if false.

8. Thanks Chris, your formula has indeed worked, and thanks for explaining why mine wasn't working as intended.

I was starting to try out seperating each statement (I think in my 3rd formula there) but I hadn't worked out to provide the true result after the end of each one, and only one false result at the end of the string....

9. I'm actually using it to report a value in a Schedule.
I can not report the "Angle" of my piping elbow, and also my piping elbows come in either 30 degree, 45, or 90 degree shapes so even if my drawing is not quite at 45 degrees then it will force that angle to be output in my list without actually changing the "Angle" parameter

I have used a shared parameter as intermediary - and my shared parameter uses the formula
if(and(Angle > 22.5°, Angle < 35°), 30°, if(and(Angle > 35°, Angle < 67.5°), 45°, if(and(Angle > 67.5°, Angle < 90°), 90°, 0°)))

The "Angle (by default)" parameter that is supplied in the elbow family for piping is a non-reportable paramater, so I had to find a work-around and as I mentioned, in addition I want to force the angles to actual fabricated values

10. Originally Posted by Karalon10

if(and(or(Angle > 22.5°, Angle < 35°, Angle = 30°), or(Angle > 35°, Angle < 67.5° , Angle = 45°), or(Angle < 67.5° , Angle = 45°), or(Angle > 67.5°, Angle < 90° , Angle = 90° )))
First.

You can not modify the value of a parameter using the parameter itself in the formula that modifies its value
So we are going to have 2 different parameters.
Angle (real value)
ANGLE (fixed value)
To the latter we assign the formula:

if(Angle < 22.5°, 90°, if( Angle < 35°, 30°,if(Angle < 67.5° , 45°, 90° )))

IF angle is less than 22.5°: ANGLE = 90°
else
IF angle is less than 35°: ANGLE = 30°
else
IF angle is less than 67.5 : ANGLE = 45°
else
ANGLE = 90°

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•