Cancel
Showing results for 
Search instead for 
Did you mean: 

Get last string character of part name into expression

Siemens Pioneer Siemens Pioneer
Siemens Pioneer

Dear Experts,

 

 I'm searching for the method/ solution of getting the last character of part name ( for example: name= 1L09FZ) in expression?

 

The use case is the following: if the last character of the part name is "Z" in the graphic viewer must be displayed "Fahrzone" text else "Weiche".

 

Thx,

Ana

3 REPLIES 3

Re: Get last string character of part name into expression

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @agherla ,

Please try below. This might help.

expression.PNG

Thanks,

Amol

Re: Get last string character of part name into expression

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @agherla ,

Below method of defining expressions will give last character of part name irrespective of string length.

expression2.PNG

Hope it helps.

Thanks,

Amol

Re: Get last string character of part name into expression

Siemens Phenom Siemens Phenom
Siemens Phenom

@agherla , another approach with single expression which will work for any part:

 

if(subString((substring(ug_askCurrentWorkPart(),1,(length(ug_askCurrentWorkPart())-4))),length(ug_askCurrentWorkPart())-4,length(ug_askCurrentWorkPart()))="Z")("Fahrzone")else("Weiche")

Just create new expression with above formula.

Regards,
Samadhan

GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!