PDA

View Full Version : Embedded IF/AND ?



The Sweg
2008-08-07, 03:06 PM
Is this formula even possible in Revit?

if ( AND (Wall Height < 15' 11" , Type Comments = "Dbl. Wall"),(Length / 1') * 2 , if ( AND ( Wall Height < 15' 11" , Type Comments = " ") , (Length / 1') * 1 , (Length / 1') * 1.75))

I know the formula works without the AND, as I had a version of it working. But I want to get several quantity results in a schedule, based on a wall height and if it's a double wall (7" thick) or greater.

Perhaps there's another way to write this and still get the result I want.

I was wondering if I'm getting an error because it's not possible to have more than one embedded AND statement?
:?
Here's the error I get:

"Improper use of boolean expressions."

Thanks in advance for any help.

mitch.cornelius
2008-08-07, 04:13 PM
I wish I could help, I have a difficult time with Revit formulas. It'd be nice if they worked more like excel formulas...

twiceroadsfool
2008-08-07, 05:11 PM
You can do it, just not like that. Since in Revit, formulas go ***if (statement, result if yes, result if no)*** you basically dont use the AND at all, you just put the entire second statement as the "result if yes*.

Basically youre saying: If the result fir state 1 is what i want, check for statement two (if the result for statement two is what i want, say "Double wall" If its not true for the second, say no.). If its not what i want (for the first, say no,

Im not in revit, but it would basically be like this, barring any syntax mistypes:

IF (Wall Height < 15'11, IF (DBL Wall, ((Length/1')*1), ((Length/1')*1.75)), (Length/1*1.75))

Im obviously assuming youre using parameters that will let you do this, etc. I might be off with a parenthesis, as im rushing. But you can make it Do IF/And with embedded IF statements... By entire egress schedule does that... (If this type of space AND occupancy more than x, do this...)

The Sweg
2008-08-07, 05:35 PM
Thanks for the help!

I see what you are saying about embedding the IF statements instead of using AND. I've done a fair share of embedded IF formulas with much success, but I've not done much with AND statements, and I've certainly never embedded more than one AND statement in a formula.

If I get this to work, I'll post it.

Thanks, again!

The Sweg
2008-08-07, 07:59 PM
OK, for anybody interested in my little exercise in nonsense, I found out, through much head-banging that I was getting an error because I was trying to use a text parameter the wrong way. You can't have things like " IF(Type Comments = "Double Wall", 2,3) " . That's not how Revit expects to use text as such.

Here is my resulting formula with custom made project parameters (which are numbers) and Yes, you can have more than one AND statement inside of embedded IF conditional statements. Sweet!

if(and(Wall Height < 15' 11", Wall Plys = 2), (Length / 1') * 2, if(and(Wall Height < 15' 11", Wall Plys = 1), (Length / 1') * 1, (Length / 1') * 1.75))

Again, thanks for all the help!

twiceroadsfool
2008-08-07, 08:26 PM
****, i forgot to write that in. Youll notice i got rid of the text parameter, and mande a parameter that was just called "Dbl wall" that would have to be a yes/no...

Sorry man, thats what i meant to explain about that...

EDIT: You might want to consider using a yes/no parameter instead of the interger or number one. Then you just write in the parameter name as the statement, cuz its jst asking if its a yes or a no. Works pretty well. (Think punch list, a yes no parameter, and a filter for "Completed...)