Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Formula with multiple statements

10 ANTWORTEN 10
GELÖST
Antworten
Nachricht 1 von 11
Teresa.KawaguchiGUSLM
595 Aufrufe, 10 Antworten

Formula with multiple statements

The result I'm working for is: 

    If multiple lenses are selected (via yes/no lens formula), return the multiple lens error.

    If one lens is selected, return the detail number (1862-XXX).

    If no lens is selected, return the no lens error.

 

I'm trying to combine these two formulas: 

if(PTZ LENS, "1862-207", if(FIXED LENS, "1862-208", if(MULTI LENS, "1862-209", "ERROR-NO LENS SELECTED")))
if(PTZ LENS, FIXED LENS, if(PTZ LENS, MULTI LENS, if(FIXED LENS, MULTI LENS, "ERROR-MULTIPLE LENSES SELECTED)))

 

TeresaKawaguchiGUSLM_0-1652972474506.pngTeresaKawaguchiGUSLM_1-1652972504301.png

 

 

 

With this, I get unexpected end of expression 

if(and(PTZ LENS, FIXED LENS, if(PTZ LENS, MULTI LENS, if(FIXED LENS, MULTI LENS, "ERROR-MULTIPLE LENSES SELECTED"))), if(PTZ LENS, "1862-207", if(FIXED LENS, "1862-208", if(MULTI LENS, "1862-209", "ERROR-NO LENS SELECTED")))

 

 

Thanks for any help. 

 

 

10 ANTWORTEN 10
Nachricht 2 von 11
ToanDN
als Antwort auf: Teresa.KawaguchiGUSLM

I didn't have my morning coffee yet to fix the formula.  But why can't you create the Y/N and Detail Number as type parameters, and create 4 family types with proper combination of Y/N boxes ticked and Detail Number value pre-entered for each type?

Nachricht 3 von 11

The family types refer to the way the camera is mounted (ie Site Pole, Corner, Unistrut, Wall Flush, Pendant). There are seven mounting options. There are four camera lens options. Having a family with 28 types (one family type for each lens type for each mounting) seems a lot.

Nachricht 4 von 11

@Teresa.KawaguchiGUSLM 

 

You are mixing text and yes/no results in the two IF statement you are trying to combine:

 


I'm trying to combine these two formulas: 

if(PTZ LENS, "1862-207", if(FIXED LENS, "1862-208", if(MULTI LENS, "1862-209", "ERROR-NO LENS SELECTED")))

The first IF statement will return one of 4 text values which is OK.

 

if(PTZ LENS, FIXED LENS, if(PTZ LENS, MULTI LENS, if(FIXED LENS, MULTI LENS, "ERROR-MULTIPLE LENSES SELECTED)))

The second IF statement tries to return 3 yes/no values and 1 text value "ERROR-MULTIPLE LENSES SELECTED" which is not supported. It is also missing a " at the end of the "ERROR-MULTIPLE LENSES SELECTED".

 

Additionally, you will not be able to combine these two for the same reason as the second IF statement. You cannot mix text and yes/no results because the parameter receiving the result can only be one or the other type.

 

if(and(PTZ LENS, FIXED LENS, if(PTZ LENS, MULTI LENS, if(FIXED LENS, MULTI LENS, "ERROR-MULTIPLE LENSES SELECTED"))), if(PTZ LENS, "1862-207", if(FIXED LENS, "1862-208", if(MULTI LENS, "1862-209", "ERROR-NO LENS SELECTED")))

 

This third statement is also mixing text and yes/no types in the first part of the AND statement. The AND statement can only work with yes/no values. 

 

Hope this helps,

 

-luc

Nachricht 5 von 11
ToanDN
als Antwort auf: Teresa.KawaguchiGUSLM


@Teresa.KawaguchiGUSLM wrote:

The family types refer to the way the camera is mounted (ie Site Pole, Corner, Unistrut, Wall Flush, Pendant). There are seven mounting options. There are four camera lens options. Having a family with 28 types (one family type for each lens type for each mounting) seems a lot.


Here is the  syntax:

IF ( AND (x = 1 , y = 2), <true>, <false>)

<true> is the part where you can enter the value directly

<false> is the part where you keep extending the formula with further [if(and(...]

 

Nachricht 6 von 11

Can I add to this a trap for two lenses being selected? 

 

TeresaKawaguchiGUSLM_1-1652976121464.png

 

TeresaKawaguchiGUSLM_2-1652976173811.png

Something like   if(and(FIXED LENS, MULTI LENS, 99), if(and(FIXED LENS, PTZ LENS, 99)  

Nachricht 7 von 11

No, you are now mixing yes/no and numerical values in the AND statements.

-luc
Nachricht 8 von 11
ToanDN
als Antwort auf: Teresa.KawaguchiGUSLM

IF (AND (P, NOT (F), NOT (M)), "1862-207", IF (AND (F, NOT (P), NOT (M)), "1862-208", IF (AND (M, NOT (F), NOT (P)), "1862-209", "ERROR")))

 

replace P, F, M with your parameters

 

ToanDN_0-1652976725245.png

 

ToanDN_1-1652976749480.png

 

ToanDN_2-1652976765978.png

 

ToanDN_3-1652976791720.png

 

ToanDN_4-1652976810445.png

 

ToanDN_5-1652976830558.png

 

ToanDN_6-1652976842589.png

 

ToanDN_7-1652976854482.png

 

 

 

 

 

 

 

 

 

 

Nachricht 9 von 11

@Teresa.KawaguchiGUSLM 


It seems to me that your are basically trying to tell the Revit user that they have to select at least one and no more than one yes/no parameter. I would suggest that you simply change the error message to say this "ERROR - NONE OR TOO MANY LENS OPTIONS SELECTED" or "ERROR - CHOOSE ONE AND ONLY ONE LENS OPTION IN THE PARAMETERS".

 

The if statement then becomes:

 

if(PTZ LENS, "1862-207", if(FIXED LENS, "1862-208", if(MULTI LENS, "1862-209", "ERROR-NONE OR TOO MANY LENS OPTIONS SELECTED")))

 

Sorry, didn't work but you could use @ToanDN formula and possibly extend it to give two distinct error messages this way:

IF (AND (P, NOT (F), NOT (M)), "1862-207", IF (AND (F, NOT (P), NOT (M)), "1862-208", IF (AND (M, NOT (F), NOT (P)), "1862-209", IF (AND(P,F,M),"ERROR1", "ERROR2"))))

 

ERROR1 = CHOOSE AT LEAST ONE LENS

ERROR2 = CHOOSE ONLY ONE LENS

 

Hope this helps;

 

-luc

Nachricht 10 von 11
Teresa.KawaguchiGUSLM
als Antwort auf: ToanDN

Thank you!

Nachricht 11 von 11

This is the solution I needed. 

Much appreciation for your help in getting here. 

TeresaKawaguchiGUSLM_0-1652982453434.png

 

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report