• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Architecture Customization

    Reply
    Contributor
    Posts: 15
    Registered: ‎01-13-2005
    Accepted Solution

    Property Set Definition "if a number equals text"

    224 Views, 3 Replies
    08-08-2012 09:53 AM

    Hi All,

     

    I having problems trying to resolve a formula in the property definitions. I have a field that has USAGENO 060, 050 that the user inputs. But I would like to auto populate another field ROOMNAME with its corresponding text, to reduce input and avoid user error. The number always equals a room name as shown below.

     

    060=Office

    050=Lobby

     

    I tried on the ROOMNAME field this but its not working, anyone know what is wrong. My field is set to formula.

     

    =IF[USAGENO]=060,"Office",IF[USAGENO]=050,"Lobby"))

     

    Thank you.

     

    alex

    Please use plain text.
    *Expert Elite*
    Keith.Brown
    Posts: 751
    Registered: ‎03-13-2008

    Re: Property Set Definition "if a number equals text"

    08-08-2012 09:59 AM in reply to: alekzab

    This is how i would do it.

     

    Select Case "[USAGENO]"

     

         Case "060"

              RESULT = "Office"

         Case "050"

              RESULT = "Lobby"

    End Select

     

     

     

    Notice the quotes around [USAGENO].  This will cast it to a string.  Also the quotes in the Case statement.  This also casts the values to a string.   I prefer case statements as it allows for easy upgrades in the future if you need to add more room names.

     

    Hope this helps.


    Keith Brown AutoCAD MEP BLOG | RSS Feed
    Please use plain text.
    Contributor
    Posts: 15
    Registered: ‎01-13-2005

    Re: Property Set Definition "if a number equals text"

    08-08-2012 10:23 AM in reply to: Keith.Brown

    It worked! thanks a lot for your help!

     

    Alex:catvery-happy:

    Please use plain text.
    *Expert Elite*
    Keith.Brown
    Posts: 751
    Registered: ‎03-13-2008

    Re: Property Set Definition "if a number equals text"

    08-08-2012 11:17 AM in reply to: alekzab

    I forgot to add this portion of it.  I always put an else statement in my select case statement as shown.  you could leave the quotes empty if you don't want to output a message but I always find it good coding practice to have in it there at least.

     

    Select Case "[USAGENO]"

     

         Case "060"

              RESULT = "Office"

         Case "050"

              RESULT = "Lobby"

         Case Else

              RESULT = "** ERROR - Usage Number Not Found! **"

    End Select


    Keith Brown AutoCAD MEP BLOG | RSS Feed
    Please use plain text.