Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help need with string generation

Hi,

I have a string/name say Xavier, Saritha. I need to only the part Xavier, S. How can we achieve this in Qlikview. Someone please help me.

Thanks

Saritha Xavier

1 Solution

Accepted Solutions
Not applicable
Author

Hi Saritha,

something like the below should work for you.

Subfield(field,',',1) & ', ' & Left(Trim(Subfield(field,',',2)),1) & '.' As newfield

hope that helps

Joe

View solution in original post

7 Replies
Ralf-Narfeldt
Employee
Employee

If you have the name in a field called Name:

Left(Name, Index(Name, ',')+2)

qumniusomnius
Contributor III
Contributor III

you can format strings with these functions: left, mid ,right and subfield

depends on what your data looks like choose the most suitable

in your case it would probably be subfield:


subfield(FieldName, ',', 1) for left of comma

subfield(FieldName, ',', 2) for left of comma

Kushal_Chawda

Try,

=Mid(Name,1,Index(Name,',',1)+2)

Not applicable
Author

Hi Saritha,

something like the below should work for you.

Subfield(field,',',1) & ', ' & Left(Trim(Subfield(field,',',2)),1) & '.' As newfield

hope that helps

Joe

sasiparupudi1
Master III
Master III

=SubField('Xavier, Saritha',',',1)&','& mid(trim(SubField(' Xavier, Saritha',',',2)),1,1)

Not applicable
Author

Thanks Joe , Subfield(field,',',1) & ', ' & Left(Trim(Subfield(field,',',2)),1) & '.' As newfield gave me the solution. even if space is there after  ',' the result is correct. Thank you .

Not applicable
Author

no worries glad to help