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

SubField Function Struggle

Hi All,

I want to take separate column (Distributor Name) from which is copied  below the screenshot.

I took Distributor Code by this expression:

SubField([Distributor Name & Code],' ',1) as Distributor_Code

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

My solution works as you want !

trim(replace([Distributor Name & Code],Left([Distributor Name & Code],Index([Distributor Name & Code],' ')-1),'')) as [Distributor Name], 

Left([Distributor Name & Code],Index([Distributor Name & Code],' ')-1) as [Distributor Code]

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

7 Replies
micheledenardi
Specialist II
Specialist II

Try this solution:

Distributor:

load

trim(replace(Distributor,Left(Distributor,Index(Distributor,' ')-1),'')) as [Distributor Description],

Left(Distributor,Index(Distributor,' ')-1) as [Distributor Code],

Distributor

Inline [

Distributor

00123 Dist1

56    Dist2

598215689 Dist3

1 Dist4

458 Dist5];

And the result is:

2018-05-17 08_20_14-QlikView x64 - Copia del rivenditore - [M__test.qvw_].png

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
sagar_puri
Partner - Contributor III
Partner - Contributor III

Hi Dinesh,

Your expression is absolutely correct only issue is the delimiter spacing.

I tried out using  SubField(Distributor,'  ',1) as testvalue  and got the required result.

Regards,

dineshm030
Creator III
Creator III
Author

I took Distributor code.

I want to take like this

stalwar1

jayshrinipurte
Partner - Creator
Partner - Creator

hi Dinesh,


Try this,


SubField([Distributor Name & Code],'  ',2) as Distributor_Code


Regards,

Jayshri

sagar_puri
Partner - Contributor III
Partner - Contributor III

Hi ,

Try the expression shared by jayshri it works fine.

micheledenardi
Specialist II
Specialist II

My solution works as you want !

trim(replace([Distributor Name & Code],Left([Distributor Name & Code],Index([Distributor Name & Code],' ')-1),'')) as [Distributor Name], 

Left([Distributor Name & Code],Index([Distributor Name & Code],' ')-1) as [Distributor Code]

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

How about this

Trim(Mid([Distributor Name & Code], Index([Distributor Name & Code], ' '))) as [Distributor Name]