Author Topic: fix Nested If-Then-Statement  (Read 257 times)

0 Members and 1 Guest are viewing this topic.

jtm2020hyo

  • Newt
  • Posts: 135
fix Nested If-Then-Statement
« on: Today at 02:45:33 AM »
hello everyone.

 

Probably I found a bug with the VBScript. I was creating and experimenting a lot with the VBScript function if-then-elseif-else statement and I found something that before saving my drawing was working, but know that I was checking again simply stop working.

 

 



 



I was linking multiple functions to the function name "NAME_BY_OBJECT" which generates a different name per each different object. In images 1 and 2, everything is correct...

 

... but something weird happens with I add the object type "Hanger":

 





 

... again everything works correct, but just with hangers, but I was checking the cable trays and cable trays fitting this happens:

 




 

 

I do not what happens here.

 Then:

1) am I doing something bad?

2)if yes, how can I fix this?

3) if not, What Is wrong, and what alternatives exist?

 

PD: attached files


before:

Code: [Select]

If "[ObjectType]" = "Cable Tray" Then
RESULT = "[NAME_CABLE_TRAY]"

ElseIf "[ObjectType]" = "Cable Tray Fitting" Then
RESULT = "[NAME_CABLE_TRAY_FITTING]"

Else
RESULT = "NA"

End If

 
after:

 
Code: [Select]

If "[ObjectType]" = "Cable Tray" Then
RESULT = "[NAME_CABLE_TRAY]"

ElseIf "[ObjectType]" = "Cable Tray Fitting" Then
RESULT = "[NAME_CABLE_TRAY_FITTING]"

ElseIf "[ObjectType]" = "Hanger" Then
RESULT = "[NAME_HANGER]"

Else
RESULT = "NA"

End If