Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rajeshqvd
Creator II
Creator II

Need Script help

Hello,

Need help to get below output in OUT PUT column in qlik script.(creating new column)

IDStatusNameOUT PUT
111NO  
111NO  
111NOjonejone
111NO jone
111NO jone
111NO jone
111NO jone
222NO  
222NO  
222NOLeeLee
222NO Lee
222NO Lee
Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Table:
LOAD RecNo() as RowNum,
	 *,
	 If(ID = Previous(ID) and Len(Trim(Name)) = 0, Peek('OUTPUT'), Name) as OUTPUT;
LOAD * INLINE [
    ID, Status, Name
    111, NO,  
    111, NO,  
    111, NO, jone
    111, NO,  
    111, NO,  
    111, NO,  
    111, NO,  
    222, NO,  
    222, NO,  
    222, NO, Lee
    222, NO,  
    222, NO,  
];

Created the above in QlikView, but will work in Qlik Sense as well.... here is sample image of what I get

image.png

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

You must tell us what is the logic behind getting those values in output field.

 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ashok_rajm
Contributor III
Contributor III

Please use below syntax to create a new field.

if(Name<>peek(Name),Name) as New_Output 

 

sunny_talwar

Try this

Table:
LOAD RecNo() as RowNum,
	 *,
	 If(ID = Previous(ID) and Len(Trim(Name)) = 0, Peek('OUTPUT'), Name) as OUTPUT;
LOAD * INLINE [
    ID, Status, Name
    111, NO,  
    111, NO,  
    111, NO, jone
    111, NO,  
    111, NO,  
    111, NO,  
    111, NO,  
    222, NO,  
    222, NO,  
    222, NO, Lee
    222, NO,  
    222, NO,  
];

Created the above in QlikView, but will work in Qlik Sense as well.... here is sample image of what I get

image.png