Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I restrict the first character of a field to alphanumeric characters only?

Hi,

I am trying to restrict the field entries so that the first character has to be alphanumeric (regardless if its upper or lower case), as long as the first character is either a number or a letter. Therefore excluding all special characters.

Can anybody help with this?

Many thanks,

Jarren

5 Replies
sunny_talwar

May be this as the where statement:

Where Len(Trim(KeepChar(Upper(Left(FieldName, 1)), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'))) > 0;

Not applicable
Author

Hi Sunny,

Thank you for that, I am trying to get this at script level, as there are multiple fields that require this but not all.

Could you help with that?

Many thanks,

Jarren

sunny_talwar

This is at the script level. You cannot use Where statement in the front end of the application.

MarcoWedel

Hi,

another solution could be:

Where IsNum(Left(Text,1)) or Upper(Left(Text,1))<>Lower(Left(Text,1));

QlikCommunity_Thread_199113_Pic1.JPG

tabTestdata:

LOAD ID,

    Concat(Char) as Text

Group By ID;

LOAD RecNo() as ID,

    Chr(32+Floor(Rand()*95)) as Char

AutoGenerate 50

While Rand()>0.1;

tabAlphaNumTestdata:

LOAD Text,

    Text as TextAlphaNum

Resident tabTestdata

Where IsNum(Left(Text,1)) or Upper(Left(Text,1))<>Lower(Left(Text,1));

hope this helps

regards

Marco

MarcoWedel

please close your thread if your question is answered.

thanks

regards

Marco