cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Restrict parameter to a single character value

Ketan_Lalcheta
19-Tanzanite

Restrict parameter to a single character value

Hi

 

We can create a string type parameter whose max length can be 80 characters. Is there a way to restrict minimum size of parameter value? In other words , I just need first character in parameter value for a parameter and rest all should be discarded. Is there any configuration or option for same?

4 REPLIES 4

do a search for restricted value parameter in Creo, you will find much information.

Ketan_Lalcheta
19-Tanzanite
(To:jbob)

I believe you are telling about a set of possible values for a parameter. I am aware about this but it is not possible to change parameter type due to other business restriction. Is there any configuration which discards values other than first character for a specific string type parameter?

Without getting into programming an interface to truncate your parameter to a single character, the only option I can think of is to use 2 parameters.

Your users enter their text into parameter named FULL and enter "Whyamienteringallthistextforonecharacter"

You have a second parameter named SINGLE and use relations to extract the single character from FULL.

SINGLE = extract(FULL,1,1)

Now you use the SINGLE parameter where needed.

 

Just be sure to check the FULL parameter length so you can have a graceful handling of when it is an empty string. I.e.

IF string_length(FULL) < 1 THEN
  SINGLE = "*"
ELSE
  SINGLE = EXTRACT(FULL,1,1)
ENDIF

I've been hurt by this in the past.

Top Tags