Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
anwar_pardawala
Partner - Contributor II
Partner - Contributor II

Increase Count on Condition in Load Script

Hi Guys,

I have assign Key to raw data that i have as below, the value should be same till the value is Query.

So in Below Table when the Value is Query it should assign new Key For example 1 for Card Object and Event it would remain same than again when it encounters "Query" it becomes 2

ValueUser_AccountSearchTime
EventABC-10/01/2019 15:42
ObjectABC-10/01/2019 15:42
CardABC-10/01/2019 15:42
QueryABCFlynn10/01/2019 15:43
EventXYZ-10/01/2019 11:43
ObjectXYZ-10/01/2019 11:43
CardXYZ-10/01/2019 11:43
QueryXYZDAN10/01/2019 11:43

 

Can you please help how i can achieve this in Load script.

4 Replies
dplr-rn
Partner - Master III
Partner - Master III

Not clear what you mean.
Can you show the desired output
sunny_talwar

May be this

Table:
LOAD *,
	 RowNo() as RowNum,
	 If(Value = 'Query', RangeSum(Peek('Key'), 1), Alt(Peek('Key'), 1)) as Key;
LOAD * INLINE [
    Value, User_Account, Search, Time
    Event, ABC, -, 10/01/2019 15:42
    Object, ABC, -, 10/01/2019 15:42
    Card, ABC, -, 10/01/2019 15:42
    Query, ABC, Flynn, 10/01/2019 15:43
    Event, XYZ, -, 10/01/2019 11:43
    Object, XYZ, -, 10/01/2019 11:43
    Card, XYZ, -, 10/01/2019 11:43
    Query, XYZ, DAN, 10/01/2019 11:43
];
anwar_pardawala
Partner - Contributor II
Partner - Contributor II
Author

Thanks for Reply yes like this, but when i am applying to me data it is incorrect for couple of rows.PFA

It has assigned same Key("3") to 2 different user search

priya-Card2019-01-11 05:203  
priya-Card2019-01-11 11:5910  
priya-Card2019-01-11 12:0810  
priya-Card2019-01-11 13:0510  
priya-Card2019-01-11 14:4218  
priya-Card2019-01-11 14:4320  
58537*Search2019-01-11 11:371  
58537*Search2019-01-11 11:432  
58537danielSearch2019-01-11 11:463  
58537-Card2019-01-11 11:463  
sunny_talwar

This data looks different than the one we started with... that one we were looking for the word Query... what are we looking for in here?