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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Krish2459_58
Creator II
Creator II

dynamic string lenght

Hi ,

I have strings like 

ABCD171

ABCD1822,

ABCD19732

 

In the above I need to get if the length of the above string  >=9 then I need to show the string like 'BCD19732'.

That means the string should restict to 8 char if it >8 then value should trim left.

for ex: 

8 chr length: ABCD19732

10 chr length : ABCD197328

req output:  CD197328

9 chr length : ABCD19732

req output: BCD19732

 

formula currently using:

Table:

load *, Repeat(0, 8-Len(field_temp))&field_temp as  Field ;

LOAD

xyz as field_temp

FROM qvd(qvd);

Labels (2)
2 Replies
Mark_Little
Luminary
Luminary

IF (LEN(Field_Temp) > 8, RIGHT(Field_Temp, 8), Field_Temp) AS Field

Although

RIGHT(Field_Temp, 😎 as field 

Will probably do the same

 

N30fyte
Creator
Creator

Use right, not left...

right('ABCD197328',8) = 'CD197328'

right('ABCD19732',8)='BCD19732'