Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to identify lower/upper case/special characters with in a field

ex

House- correct format

HOUSE-Upper case

house-Lower case

#$house$- Special character

need help in scripting on

how to check a field whether

it is correctformat/upper case/

lower case/special character

18 Replies
sasikanth
Master
Master

HI,

If this is the only case left to validate then you can give that in Else part

If(Len(Trim(KeepChar(Field, '!@#$%^&*()'))) > 0, 'Special Character',

    If(Field = Capitalize(Field), 'Correct Format',

          If(Field = Upper(Field), 'Upper Case',

              If(Field = Lower(Field), 'Lower Case','Irregular Format')))) as [Error Message]

Anonymous
Not applicable
Author

Ok thank you. Modified script as below. and output is as required.

Table:

LOAD *,

  If(Len(Trim(KeepChar(Field, '!@#$%^&*()'))) > 0, 'Special Character',

    If(Field = Capitalize(Field), 'Correct Format',

    If(Field = Upper(Field), 'Upper Case',

   If(Field = Lower(Field), 'Lower Case','Irregular Format')))) as [Error Message];

LOAD * Inline [

Field

Apple

CAT

$Dog

hen

gOaT

BOAt

]

WHERE Field <>  Capitalize(Field);

Output:

Output.png

sasikanth
Master
Master

Great

Anonymous
Not applicable
Author

One more doubt is , is this cant be achieved with ASCII code. Like

assuming ASCII code as below

            

noCharnoCharDecCharDecCharDecCharDecChar
32SPACE91[48065A97a82R
33!92\49166B98b83S
34"93]50267C99c84T
35#94^51368D100d85U
36$95_52469E101e86V
37%96`53570F102f87W
38&123{54671G103g88X
39'124|55772H104h89Y
40(125}56873I105i90Z
41)126~57974J106j114r
42*47/ 75K107k115s
43+58: 76L108l116t
44,59; 77M109m117u
45-60< 78N110n118v
46.61= 79O111o119w
63?62> 80P112p120x
64@ 81Q113q121y
122

z


Is there a way where we can mention

1. if characters b/w these range it is Special characters

2. For Irregular format , where we can check each letter and specify whether it is in standarad format or not.

ex ; ElePhaNt

here can we use any loops to check each letter within a field

like E is first word of the filed, next l is second,e is third and so on. so that all words are checked for format.


sunny_talwar

Great improvisation. Thanks for sharing

sunny_talwar

1) You should be able to use MapSubString() with a Mapping load to do this

2) I am not sure I understand your description here

MarcoWedel

Hi,

maybe one solution regarding the loops to check each letter could be:

QlikCommunity_Thread_250187_Pic1.JPG QlikCommunity_Thread_250187_Pic2.JPG

QlikCommunity_Thread_250187_Pic3.JPG

QlikCommunity_Thread_250187_Pic4.JPG

QlikCommunity_Thread_250187_Pic5.JPG

QlikCommunity_Thread_250187_Pic6.JPG

tabWords: 

LOAD RecNo() as ID ,*

INLINE [

    Word

    Apple

    2Apples

    CAT

    Cat3

    $Dog

    hen

    gOaT

    BOAt

    House

    5Houses

    HOUSE

    house

    #$house$

    ElePhaNt

    ϘλικVιεω

];

tabWordChar:

LOAD ID,

     Mid(Word,IterNo(),1) as Char,

     IterNo() as Position

Resident tabWords

While IterNo()<=Len(Word);

tabChar:

Left Keep (tabWordChar)

LOAD *,

     Pick(Match(1,[Upper Case Letter]*1,[Lower Case Letter]*1,Number*1,[Special Character]*1),'A','a',Text('0'),'$') as CharSymbol;

LOAD *,

     If(Letter and Char=Upper(Char),Dual('Yes',1),Dual('No',0)) as [Upper Case Letter],

     If(Letter and Char=Lower(Char),Dual('Yes',1),Dual('No',0)) as [Lower Case Letter],

     If(not (Letter or Number),Dual('Yes',1),Dual('No',0)) as [Special Character];

LOAD *,

     If(IsNum(Char),Dual('Yes',1),Dual('No',0)) as Number,

     If(Upper(Char)<>Lower(Char),Dual('Yes',1),Dual('No',0)) as Letter;

LOAD RecNo() as Ord,

     Chr(RecNo()) as Char     

AutoGenerate 65535;

mapChar:

Mapping LOAD Char, CharSymbol Resident tabChar;

Left Join (tabWords)

LOAD Distinct

     Word,

     MapSubString('mapChar',Word) as WordFormat

Resident tabWords;

tabCharType:

CrossTable (CharType, CharTypeYesNo)

LOAD Distinct

     Char,

     Number,

     Letter,

     [Upper Case Letter],

     [Lower Case Letter],

     [Special Character]

Resident tabChar;

Right Join LOAD 1 as CharTypeYesNo AutoGenerate 1;

DROP Field CharTypeYesNo;

hope this helps

regards

Marco

Anonymous
Not applicable
Author

this is matching with my requirement sir, thanks a ton.

MarcoWedel

You're welcome.

Glad it helped

Regards

Marco