Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hey i am new to qlikview , now i have got a listbox of names like
navneet kaushal
P.K jaiswal
S.P singh
balraj ahlawat
nikita barodia
now i want to seperate first name AND last name and only want to show first name but when it is p.k jaiswal or s.p singh it should show the full name ,can someone tell me any expression to do this?
and if it is possible through any expression please tell me how it is done?
Hi.
There some useful string functions in QV:
=if(SubStringCount(Names, '.')>0, Names, SubField(Names, ' ', 1))
you can try something like
if(index(FullName,'.')>0,Name , left(FullName,index(FullName,'.')-1) AS FirstName
like:
=If(Index(Name,'.'), Name, SubField(Name,' ',1))
Like this
L:
Load * Inline [
AA
P.K jaiswal
S.P singh
balraj ahlawat
nikita barodia
];
Res:
Load *,
IF(SubStringCount(AA,'.')=0,SubField(AA,' ',1),AA) as AAA
Resident L;
Drop Table L;
Hope this helps you..!
TableA:
LOAD * Inline [
name
navneet kaushal
P.K jaiswal
S.P singh
balraj ahlawat
nikita barodia
];
LOAD SubField(name,' ',-1)as LName,
SubField(name,' ',1)as FName
Resident TableA;
Try this..
Subfield(Name,' ',1) as First Name, // gives the first part of the name
Subfield(Name,' ',2) as Last Name, // gives the second part of the name
Ex:
Subfield('Qlik Community',' ',1) ---> Qlik
Subfield('Qlik Community',' ',2) ---> Community
Thanks,
Pradeep
Hi,check this..
HTH,
Ravi N.
Hi there , try this
Load *,
if(len(trim(keepchar(Names,'.'))>0,Names,subfield(Names,' ',1)) as FirstName
subfield(Names,' ',2) as LastName
from TABLE;