您好,我终于找到了一个可能的解决方案
您的代码发布在这里:
- RESULT = "NA"
- If "[ObjectType]" = "Cable Tray" Then
- RESULT = "[NAME_CABLE_TRAY]"
- End If
- If "[ObjectType]" = "Cable Tray Fitting" Then
- RESULT = "[NAME_CABLE_TRAY_FITTING]"
- End If
- If "[ObjectType]" = "Hanger" Then
- RESULT = "[NAME_HANGER]"
- End If
工作并解决了这个问题,但是我需要在每个公式函数中插入这个结构,但我需要添加一个额外的比较语句和过滤对象,以最终减少字符的数量 - RESULT = "NA"
- If ("[ObjectType]") = ("Cable Tray") And ("ParType" = "Trunking") Then
- RESULT = "[NAME_CABLE_TRAY]"
- End If
- If ("[ObjectType]") = ("Cable Tray Fitting") And ("ParType" = "Elbow")Then
- RESULT = "[NAME_CABLE_TRAY_FITTING]"
- End If
- If ("[ObjectType]") = ("Hanger") Then ("Anchor_System" = "Electric")
- RESULT = "[NAME_HANGER]"
- End If
但是这需要分析每个公式并完全失去它们的美,出于这个动机,我在结尾添加了If-ElseIf-Else-End-If语句
- 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
这是原始脚本,理论上应该可以用,但它没有#039;t、 最后,Else语句应该是';不让代码工作?我的意思是,否则最终应该等于;结果=“”;一开始。我在做坏事
|