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

Restrict parameter to a single character value

Ketan_Lalcheta
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?

Tags (3)
4 REPLIES 4

Re: Restrict parameter to a single character value

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

Re: Restrict parameter to a single character value

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?

Re: Restrict parameter to a single character value

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.

 

Re: Restrict parameter to a single character value

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.

Announcements