-
Formula help please
Hi all,
I'm afraid I don't understand these conditional statements at all - and yes I have read the useless summary in the help file (they need to add a visual real world example, not just a bunch of hypothetical numbers...)
I would like to make a void height parameter which will always be taller or as tall as 3 solid elements which have variable heights.
So I want this void to always match the height of whichever solid is tallest at the time.
In non-mathmatical terms, I need something like:
Void height = The greatest of either A height, B height or C height
Help would be great : )
Cheers
-
Re: Formula help please
Could an IF statement work?
Void Height = IF(A>B or C, A, B or C) (B>A or C, B, A or C) (C>A or B, C, A or B) ???
I guess you can't have 'or' in a formula?
My brain hurts...
-
Re: Formula help please
You're formula doesn't make a lot of sense to me, because I don't know which one to pick, B or C. Revit my also be thinking (Which one do you want, 'B' or 'C'). You might try something similar to 'If(A>(B or C), A, B)'.
Hope this helps,
Jeff S.
-
Re: Formula help please
Jeff.
I´m to tired to figure out how to do this in one line of formula, but it´s fairly easy, when using an extra calculation parameter
Calc 1 = if(Solid A > Solid B, Solid A, Solid B)
then
Void Height = if(Calc 1 > Solid C, Calc 1, Solid C)
Well, just look at the attached, and see for yourself :beer:
-
Re: Formula help please
try that, not tested, 0.0 value is just a junk number (can be any number) because it will never be a case.
H = if(or(A > B, A > C), A, if(or(B > A, B > C), B, if(or(C > A, C > B), C, 0.0)))
-
Re: Formula help please
logically you also have to think the equal cases, like below:
H = if(or(A > B, A > C, A = B, A = C), A, if(or(B > A, B > C, B = A, B = C), B, if(or(C > A, C > B, C = A, C = B), C, 0.0)))
-
Re: Formula help please
Joe.
Just tested your suggestions, but in either case it´s not working when "C" is the greatest.... Been strugling my brain with it, and really dont see a way to do it, with just one line of code - It´s possible to test for several different conditions IF, AND, OR - but only possible to return a value for false, and one for true... :beer:
-
Re: Formula help please
right, seems using "and" is more logically sound, try following to see if it works:
1) no equal cases allowed
H = if(and(A > B, A > C), A, if(and(B > A, B > C), B, if(and(C > A, C > B), C, 0.0)))
2) equal cases also considered
H = if(and(or(A > B, A = B), or(A > C, A = C)), A, if(and(or(B > A, B = A), or(B > C, B = C)), B, if(and(or(C > A, C = A), or(C > B, C = B)), C, 0.0)))
again, not tested, give me a shout if it works.
if it still doesn't work, then using family API will be a way out, i haven't tried API at family level yet.
-
Re: Formula help please
Joe.
1) Works, unless there´s two equal numbers, then "0" is returned as the value.
2) Works like a charm :-) So I stand corrected ! :beer:
-
Re: Formula help please
Hi guys,
Thanks very much for all the input :)
None of it makes much sense to me at first glance though... Like I said, I really don't get these statement formulas yet.
I shall put my mathemetician hat on and have a play though.
Thanks again