Skip to main content
1-Visitor
April 15, 2021
Question

Restrict parameter to a single character value

  • April 15, 2021
  • 2 replies
  • 2593 views

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?

2 replies

12-Amethyst
April 15, 2021

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

1-Visitor
April 15, 2021

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?

23-Emerald III
April 15, 2021

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.

 

21-Topaz II
April 15, 2021

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.