NX NX: Problem with setting right-hand side of string expression.

2021-10-06T23:26:20Z
NX Open NX System Administration

Summary


Details

When using EditWithUnits and trying to pass in a variable for a string expression you may receive a datatype error.


 Dim xyz As String = "123456"
  workPart.Expressions.EditWithUnits(expression1, nullUnit, xyz)

Solution

This will happen because NX expects to receive a string value for the input. 
Although XYZ in this case -

 Dim xyz As String = "123456"
  workPart.Expressions.EditWithUnits(expression1, nullUnit, xyz) 

 - is defined as a string, NX interprets it as an integer. To correct the issue, escape the double-quote (") character and include it in the value: 

Dim xyz As String = """123456""" \\ for VB
 workPart.Expressions.EditWithUnits(expression1, nullUnit, xyz)

Hardware/Software Configuration

Platform: INTL64
OS: window
OS Version: 764SP1
Product: NX
Application: SYSENG
Version: V8.0
Function: NXOPEN

Ref: 001-9164748

KB Article ID# PL8004278

Contents

SummaryDetails

Associated Components

Block/UI Interface Stylers Knowledge Fusion Menuscript NX Open - All Languages NX Open Python Open for C/C++ Open for CAE Open for GRIP Open for Java Pre-NX6 UI Styler SNAP UDO