Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Mastering Change Data Capture: Read Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I want to split a string into 35 charcters.


Hi,

           It;s urgent.I tried a lot but i didnt get it:

a string has many charcters :

1st 35 charcters into one field but should complete a word  .

ex:  the premium life insurance corporate company   which has a filed name  NM

it comes:

left(NM,35)

result:

the premium life insurance corporat           into NM1

e company                                                   into NM2

but  i want

the premium life insurance                             into NM1

corporate company                                          into  NM2

pls help.Thanks in advance

24 Replies
sunny_talwar

Tried this?

Table:

LOAD *,

  Left(Field, 35) as OldNM,

  If(Len(Field) <= 35, Field, Left(Field, (Index(Left(Field, 36), ' ', -1)))) as NM1,

   If(Len(Field) <= 35, '', Right(Field, (Len(Field) - (Index(Left(Field, 35), ' ', -1))))) as NM2 ;

LOAD * Inline [

Field

the premium life insurance corporate company

];

sunny_talwar

Can you try this:

Tried this?

Table:

LOAD *,

  Left(Field, 35) as OldNM,

  Trim(If(Len(Field) <= 35, Field, Left(Field, (Index(Left(Field, 36), ' ', -1))))) as NM1,

  Trim(If(Len(Field) <= 35, '', Right(Field, (Len(Field) - (Index(Left(Field, 35), ' ', -1)))))) as NM2 ;

LOAD * Inline [

Field

the premium life insurance corporate company

];

Not applicable
Author

Hey sunindia,

                             Excellent ,It's Working  .Thank u.

I just used the expression for NM1 and NM2 in straight table.

Thank u.

I have many issues..I will keep posting  soon  ....Pls Reply....

Thanks  To all Who RESPONDED..................

sunny_talwar

Awesome

I am glad it worked.

I would suggest closing this thread by marking the answer as correct.

Best,

Sunny

Not applicable
Author

Hi Sunny,

I have an issue can u give me ur email i.d where I can send u my issue.I cant post it here open