View Full Version : Calculated Value
atowne
2010-07-27, 03:29 PM
I have an average mixed use parking calculation which I'd like to complete out of the area plan I've created.
Using just two parameters "Name" and "Area" I'm attempting to create a calculated value like so, IF (Name = OFFICE, Area / 300, IF (Name = AUDITORIUM, Area = 77, 0))... But it errors out at OFFICE even though this is a valid name for an area.
Second attempt IF(Area = 18585 SF, Area / 300 SF, IF(Area = 8205 SF, 77, 0)) The two square footages are for the OFFICE and AUDITORIUM, which are all I was trying to capture at this point. This formula results in every calc value coming out to 0, switch it to a 1 in the formula and you get a 1.
Some help would be awesome.
Alfredo Medina
2010-07-27, 03:47 PM
Text data is not allowed within the conditional statement. You need to create an instance integer parameter, for example "RoomType", that applies to the type of entities that you are scheduling. Then, assign an integer value for each type of room. Then include that parameter in your schedule. Then create a calculated value of area type, with the formula.
If there are only two types, 0 for Office and 1 for Auditorium, it's a simple IF, like this:
If RoomType is 0 (it's an Office), Divide "Area" by 300, otherwise, make my value 77 :
IF ( RoomType = 0, Area / 300, 77)
If there are more room types, 1, 2, 3, etc. ... you need to use embedded IF's, like this:
IF(RoomType=0, Area/300, IF(RoomType = 1,77, IF(RoomType = 2, 50,100)))
nharburger
2010-10-05, 09:00 PM
If there are more room types, 1, 2, 3, etc. ... you need to use embedded IF's, like this:
IF(RoomType=0, Area/300, IF(RoomType = 1,77, IF(RoomType = 2, 50,100)))
ok.... I have a big Embedded IF issue here - i am trying to write my frist Embedded IF Formula - but i am doing so for plumbing fixture counts based on an IPC table... so there are 26 different categories / options / formulas...
I wrote each one seperately in word to keep them straight - and then combined all of them into a single line for the calculated value formula. However i am getting a "Bad IF Statement format" error message saying that i am not following the proper format.
I get that this is a ridiculously long formula, but any chance anyone could review it to see where i went wrong?
gaby424
2010-10-05, 09:12 PM
copy paste the formula in word then ctrl+f and check if the number of "(" and ")"are equal
nharburger
2010-10-05, 09:14 PM
Well - that is much easier than my pointing with my finger on the screen method :)
nonetheless - there are an equal number of each - 56.
Alfredo Medina
2010-10-06, 11:59 AM
The format for an IF formula is:
IF ( condition , <result if true > , <result if false> )
In embedded IF's, the <result if false> part is another IF. Therefore, the last IF, because it is the last one, must have a <result if false> that is a value.
Look at my example in my previous message:
IF(RoomType=0, Area/300, IF(RoomType = 1,77, IF(RoomType = 2, 50,100)))
The number '100' is the last <result if false> part that I am talking about. Since this is the last IF, you need to tell Revit "otherwise, do this". You're missing that part in your formula. (Without looking at other issues)
arqt49
2010-10-06, 12:27 PM
I wouldn't use formulas like that.
My suggestion is a rooms key schedule. The key would be "OFFICE", "AUDITORIUM", etc.
Then I would add a type_value parameter with the corresponding value of 300, 77, etc.
Those parameters will be very easy to control, and the main schedule would just have a Area/type_value formula.
It seems so much simpler.
nharburger
2010-10-06, 12:53 PM
Thanks Alfredo!
That seems to have fixed the problem. I took out all of the line items that had a conditional true = "WATER_CLOSETS_MALE" and had that just be the universal False condition...
Only problem is that that parameter was a Text parameter that had things like "1 per bed" or "1 per cell" typed in - and therefore cannot be displayed within the number calculated value
Is there any way in an IF/THEN calculated value to have numbers and text be the result?
Alfredo Medina
2010-10-06, 01:27 PM
Thanks Alfredo! That seems to have fixed the problem. ...Is there any way in an IF/THEN calculated value to have numbers and text be the result?
No. That is true in programming languages where there is a data type called "variant", which accepts multiple kinds of data types, but in the features available for the Revit user, the data type defines the result. If the data type is Text, you can't give it an integer, and vice versa.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.