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

Need Help

Hi Everyone,

I have below sample data -:

Product Code       Product

101                         A_1

102                         B_2

103                         C 123

104                          D_3  

105                          F maximum

106                          G minimum

107                          H_4

108                          I_5

in above data i want only those data which is present after underscore and remaning cases same data.

Expecated O/P-:

Product Code       Product

101                         1

102                         2

103                         C 123

104                         3  

105                         F maximum

106                         G minimum

107                         4

108                         5

Thanks in advance,

Ishwar

7 Replies
Not applicable
Author

Hi Ishwar,

you can use the textbetween function

textbetween(Product,'_','')

hope that helps

Joe

PrashantSangle

Hi,

Use subfield()

Like subfield(Product,'_',2)

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ashfaq_haseeb
Champion III
Champion III

May be like this

load *, if(len(trim(Product))=3,SubField(Product,'_',2),Product) as Test,

if(wildmatch(Product,'*_*'),subfield(Product,'_',2),Product) as NewProduct;

load * Inline

[

ProductCode,Product

101,A_1

102,B_2

103,C 123

104,D_3 

105,F maximum

106,G minimum

107,H_4

108,I_5

];

Regards

ASHFAQ

PrashantSangle

Hi,

try like this

if(wildmatch(Product,'*_*'),subfield(Product,'_',2),Product) as New Product

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi,

You can use

 

IF (ISNULL(SubField(Product,'_',2)),Product,SubField(Product,'_',2)).

Please find the attached file.

Hope this will helps for you.

-Sathish

ashfaq_haseeb
Champion III
Champion III

Or you can even try this.

if(wildmatch(Product,'*_*'),subfield(Product,'_',2),Product) as NewProduct;

Regards

ASHFAQ

maxgro
MVP
MVP

subfield(Product,'_',if(index(Product,'_')=0,1,2))