Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rajeshqvd
Contributor 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

Re: Need Script help

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

Re: Need Script help

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

 

Regards,

Kaushik Solanki

ashok_rajm
New Contributor III

Re: Need Script help

Please use below syntax to create a new field.

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

 

Re: Need Script help

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