Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

subfield,left

ProductCategorySubCategory
Edelweiss Tokio Group Credit Protection - SMEedelweiss tokio group CREDIT PROTECTION
Edelweiss Tokio Group Credit Protection - SME - NEWedelweiss tokio group CREDIT PROTECTION
Edelweiss Tokio Life - Cash Flow Protectionedelweiss tokio life CASH FLOW PROTECTION
Edelweiss Tokio Life - Protection - (Reg/5/10/15Pay)edelweiss tokio life PROTECTION
Edelweiss Tokio Life - Protection - (Reg/5/10/15Pay) - OLDedelweiss tokio life PROTECTION
Edelweiss Tokio Life - Protection - (Single Pay)edelweiss tokio life PROTECTION
Edelweiss Tokio Life - Protection  - (Single Pay) - OLDedelweiss tokio life PROTECTION
Edelweiss Tokio Life - Save n Prosperedelweiss tokio life SAVE N PROSPER
Edelweiss Tokio Life - Single Pay Endowment Assurance Planedelweiss tokio life SINGLE PAY ENDOWMENT ASSURANCE PLAN
Edelweiss Tokio Life - Single Pay Endowment Assurance Plan - OLDedelweiss tokio life SINGLE PAY ENDOWMENT ASSURANCE PLAN

I have a product field as input ,i wanna split the product in cateory and sub cateory as shown above , can i have expresion fr tat

20 Replies
Anil_Babu_Samineni

I agree with Peter. Because, Your data is not proper structure as much i replied earlier having some structured and make sense to me. Will you conclude this?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Is there a master list which defines the possible values for Category and SubCategory. I mean there needs to be some way to identify what can possibly be a Category and what can possible be SubCategory.

vignesh_s
Creator
Creator
Author

no there is no such list,from Product field i wanna split string in to category and sub category

sunny_talwar

But how do you do this? I mean if I give you this line in your Product field... what would you use to divide them out

My Name is Sunny and you are my friend

This is a very stupid example, but you get the idea... I can get infinite number of variation of data in Product column, how do I know what is category and what is Subcategory? Does it make sense?

Or
MVP
MVP

The product is 'Sunny' and the category is 'helpful person'

But back on the original track - there's no way to teach a computer to pick out the product and category if you, as a human, can't tell it how. If you don't know either, then your request is impossible - you can use assorted algorithms that involve text similarity to try and guess, but ultimately, it's just guesswork.

vignesh_s
Creator
Creator
Author

one thing i tought of ,the 1st 3 words form Category and rest form sub category but in sub category v wanna eleminate some words

sunny_talwar

May be try this

Table:

LOAD Left(Product, Index(Product, ' ', 3)-1) as Category,

Upper(SubField(SubField(Replace(LTrim(Replace(Right(Product, Len(Product) - Len(Left(Product, Index(Product, ' ', 3)-1))), ' - ', '  ')), '  ', ' - '), ' - ', 1), ' (', 1)) as SubCategory,

Product

FROM

[..\..\Downloads\String Task 1.xls]

(biff, embedded labels, table is Sheet1$);


Capture.PNG

vignesh_s
Creator
Creator
Author

thanks a lot

Anil_Babu_Samineni

Liked It !!!

Sunny, One quick question - can you tell me why you are doing Replace() with -(hyphen) to space and again LTrim() to conclude for space to -(hyphen) ?? POS - I understand the concept of LTrim to use here but not sure why 2 replacements needed ??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Followed an approach similar to this to remove leading " - " in cases like these

Capture.PNG

QlikView Addict: Removing Leading Zeros