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

Need to seperate vehicle no and driver name from field, Lafarge should not come

Capture.PNG

9 Replies
qlikviewwizard
Master II
Master II

Upload some sample data and expected results.

pooja_prabhu_n
Creator III
Creator III

Hi,

You can use subfield function


SubField(vehicle_Name,'-',2)

Left(SubField(vehicle_Name,'-',2),index(SubField(vehicle_Name,'-',2),' ',3)) as Vehicle_no,

fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

Try:

Data1:

LOAD

  DATA,

  Left(SubField(DATA, 'Lafarge - ', 2), 😎 as Vehicle_NO,

  Mid(SubField(DATA, 'Lafarge - ', 2), 10) as Driver_Info

INLINE [

DATA

Lafarge - XXX YYYY Driver Name ZZZZZZZZZZZ

];

Saludos

dapostolopoylos
Creator III
Creator III

If your data have all the format "Lafarge - ABL etc" then you can use the following statement in your script:

Mid([Vehicle Name],10) as [Vehicle Name]


If the "Lafarge - " text exists omwhere in your field but not always in the start of the field use the following statement in your script:


Trim(Replace([Vehicle Name],'Lafarge - ','')) as [Vehicle Name]

Father/Husband/BI Developer
qlikviewwizard
Master II
Master II

Hi ,

You will achieve like this.

Data:

LOAD *,left(SubField(Field,'Lafarge - ',2),8) as Vehical_Number,

PurgeChar(MID(Field,20,40),'1234567890') as Driver_Name;

LOAD * INLINE [

Field

Lafarge - ABL 1234 Raju 123456789

Lafarge - CVF 2345 David 234567897

Lafarge - ASD 6789 Rama 345679005

Lafarge - BBB 9011 Donald Trump 456790113

Lafarge - TTT 5674 Arjun Rao 567901221

Lafarge - CVF 1234 Henric Consortium 679012329

Lafarge - ASD 7564 Satish 790123437

Lafarge - BBB 6578 sirisha 901234545

Lafarge - TTT 7901 Putin 1012345653

Lafarge - CVF 1801 Kamala 1123456761

];


Capture.PNG

Capture1.PNG



srikanth99
Contributor III
Contributor III
Author

Thank you arjun.

qlikviewwizard
Master II
Master II

Hi srikanth99

Happy to help you. Please Mark Correct Answer if you got the answer. Thanks in advance.

srikanth99
Contributor III
Contributor III
Author

Hi arjun,

           Please go through this link    Need to seperate vehicle no and driver name from field, Lafarge should not come    which posted with the excel file.