Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Suppress first 3 places then show characters


I have a field called work_type.  Each field value looks something like this

A.Work Central

B.Work South

I want to suppress the first character (the letter, in this case A B etc) and the period.  So I want to show

Work Central

Work South

In my code I used this

left(work_type,3) as [Work Category] 

It produced    A.W  or B.W

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution:

LOAD Right(work_type, Len(work_type)-2) as work_type

Inline [

work_type

A.Work Central

B.Work South

];

QlikCommunity_Thread_122653_Pic1.JPG.jpg

hope this helps

regards

Marco

View solution in original post

4 Replies
MarcoWedel

Hi,

one solution:

LOAD Right(work_type, Len(work_type)-2) as work_type

Inline [

work_type

A.Work Central

B.Work South

];

QlikCommunity_Thread_122653_Pic1.JPG.jpg

hope this helps

regards

Marco

MarcoWedel

or creating your desired "Work Category" field:

LOAD *, Right(work_type, Len(work_type)-2) as [Work Category]

Inline [

work_type

A.Work Central

B.Work South

];

QlikCommunity_Thread_122653_Pic2.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Pefect.  Thank you.  I come from a SAS background in which syntax is slightly different.

johnca
Specialist
Specialist

Just a thought...if it were possible that the first character, A or B, could be AA or AB, a better solution would be like below...

Load SubField(work_type,'.',2) as work_type;  // preceeding load to remove the character and period

Load * Inline [work_type

     A.Work Central

     B.Work South

     AA.Work Europe

     AB.Work South America

];

This will return the field name after the first '.' (period) regardles of the length of the preceeding character(s). In this case;

Work Central

Work South

Work Europe

Work South America

HTH,

John