PDA

View Full Version : Conditional Statement Syntax



cek
2008-03-19, 09:55 PM
Using the following nested conditional statement

if(Occupancy="A",M.O.L.=49,if(Occupancy="B",M.O.L.=49,if(Occupancy="M",M.O.L.=49,if(Occupancy="I",M.O.L.=10,if(Occupancy="R",M.O.L.=10,if(Occupancy="S",M.O.L.=29,0))))))

I get the following error message:
"The following is not a valid schedule field: M.O.L.

This conditional statement was applied to a Calculated Value within a schedule with the given name M.O.L.

So I assumed that the conditional statement must reference an external parameter not itself, so when I make M.O.L. an separate schedule field I get the following message:

"Improper use of boolean expressions"

Is my syntax wrong or is it something else?

Calvn_Swing
2008-03-19, 10:07 PM
if(Occupancy="A",M.O.L.=49,if(Occupancy="B",M.O.L.=49,if(Occupancy="M",M.O.L.=49,if(Occupancy="I",M.O.L.=10,if(Occupancy="R",M.O.L.=10,if(Occupancy="S",M.O.L.=29,0))))))


In Revit, conditional assignments are assumed. So, the correct syntax for your statement is:

if(Occupancy="A",49,if(Occupancy="B",49,if(Occupancy="M",49,if(Occupancy="I",10,if(Occupancy="R",10,if(Occupancy="S",29,0))))))

Now, the only question is whether Revit will let you drive a numeric parameter value off a text parameter value... Not sure about that one...

cek
2008-03-19, 10:23 PM
That doesn't seem to be working

if(Occupancy="A",49,if(Occupancy="B",49,if(Occupancy="M",49,if(Occupancy="I",10,if(Occupancy="R",10,if(Occupancy="S",29,0))))))

Only gets me the "improper use of boolean expression" message. Kelly did you get this syntax to work?

Steve_Stafford
2008-03-20, 05:56 AM
Don't think you are going to get that to work with that strategy. Revit doesn't seem to be willing to reconcile the "text" parameter occupancy as a valid value to determine what response to provide to your calculation. You can use a schedule key however to choose the occupancy type and provide the value you need. Then you can use a calculated value to do more work on that.

Elmo
2008-03-20, 01:35 PM
Try taking the exclimation marks and try not to use fullstop in your parameter names. I had problems with that before. Otherwise it looks like the conditional statement should work.

cek
2008-03-20, 04:49 PM
Thanks Steve!

Sometimes backing up and taking a different road can get you where you want to go. Appreciate the road map.

Calvn_Swing
2008-05-19, 06:12 PM
Glad you got it to work, key schedules are a great tool for this situation as they basically handle the formula for you. However, I got the formula to work fine - though I tried it in a family not a schedule calculated value. Sometimes Revit is tricky and lets some things work in one situation and won't let them work in another...