AutoCAD Architecture Customization

AutoCAD Architecture Customization

Reply
Active Contributor
alekzab
Posts: 39
Registered: ‎01-13-2005
Message 1 of 4 (526 Views)
Accepted Solution

Property Set Definition "if a number equals text"

526 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

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.

*Expert Elite*
Keith.Brown
Posts: 1,180
Registered: ‎03-13-2008
Message 2 of 4 (524 Views)

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
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Active Contributor
alekzab
Posts: 39
Registered: ‎01-13-2005
Message 3 of 4 (521 Views)

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:

*Expert Elite*
Keith.Brown
Posts: 1,180
Registered: ‎03-13-2008
Message 4 of 4 (518 Views)

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
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.