Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Limiting output string length in Post builder

Hello Post Experts.

 

I'd like to limit the number of characters of an output literal statment.  In my post I am using the following:

 

global mom_group_name

 

MOM_output_literal "$mom_group_name"

 

I'd like to limit the number of charaters in the"$mom_group_name" to 5 alpha nummeric characters.  So even if my group name in NX is O2222-modified, I only want to output O2222

 

Any thoughts?

 

Using NX9 and PB 9.0.2.0

 

Thanks

 

Jerry

2 REPLIES
Solution
Solution
Accepted by topic author Vizionmaster
‎11-18-2015 12:15 PM

Re: Limiting output string length in Post builder

MOM_output_literal [format "%.5s" $mom_group_name]

The above should truncate the output to five characters from the left.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community
Solution
Solution
Accepted by topic author Vizionmaster
‎11-18-2015 12:15 PM

Re: Limiting output string length in Post builder

Maybe something like this:

 

global mom_group_name
set out_string [string range $mom_group_name 0 4]
MOM_output_literal "$out_string"

 

You could also be more intelligent about it (checking for spaces/underscores, make sure it starts with the letter O followed by digits, etc.) 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Learn online





Solution Information