Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ritumishra01
Contributor III
Contributor III

Subfield

I have 

completed/inprogess/started

completed /started/

completed//

started//

as status now i want to get last value only in my expression using if condition 

i need

started

started

completed 

started

last value everytime it should give me how can i achieve this .

 

Labels (3)
4 Replies
Lisa_P
Employee
Employee

here is some script logic that works either in a chart or in the data load editor

Lisa_P_0-1691715619352.png

 

MayilVahanan

Hi

Try like below

Temp:
LOAD *, SubField(F1, '/') as F2, RowNo() as F3 INLINE [
F1
completed/inprogess/started

completed /started/

completed//

started//
];

Inner Join
Load F1, Max(If(Len(F2)>0, F3)) as F3 Resident Temp Group by F1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
MayilVahanan

hi

Suppose, if you want in front end expression alone, then try like below

If(Right(F1, 2) = '//', SubField(F1, '//',1), If(Right(F1, 1)='/', SubField(F1, '/',2), SubField(F1, '/',3)))

but not sure, is it suit for all ur data.. 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
MarcoWedel

Hi,

another expression might be

 

SubField(Replace(Replace(Trim(Replace(Replace(status,' ','<space>'),'/',' ')),' ','/'),'<space>',' '),'/',-1)

 

MarcoWedel_0-1692032235338.png

hope this helps

Marco