Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
markgraham123
Valued Contributor

Create a sequence number and create buckets

Hi all,

I'm working on a requirement where i have to

1. Sort my data by time and Order

2. Create a sequence number group by Time. An order gets only 1 sequence #.

I'm only able to create sequence # grouped by Time but not able to give just  only 1 sequence # to an order.

3. Create buckets of 16 or 8 orders. In my below example data, if i'm not able to create a bucket of 16 or 8, then i give them '99999' value. First priority is to create 16 orders bucket and then 8.

Any help is highly appreciated. Please see attached QVW.

BucketSequenceOrderSKUTime
11120960148683977
12120961506859307
13159092150504607
131590921501279087
14159095632474167
14159095632764287
151590977981142057
16159110791524807
17159117140913807
171591171401437587
18159119418766997
999999159121210905757
99999101591270361512667
11120873063868818
12120879952849998
13120880115489698
14120882274917228
151209118231135788
161209937121408708
171209937181063458
18121021508868248
19121022075757488
110121023970647218
1111210303121408648
1121210351481084368
113121044204940538
114121063982601358
1151210657251152948
116121073529646828
2171211128741431248
218121120191862798
2191211208111077358
2201211255671304268
220121125967486788
221121125986770858
222121126490697438
223159055750895558
224159121194481018
224159121194517588
9999925159121557927898
9999926159122588481038
99999271591231391447528
9999928159123777848398

 

1 Solution

Accepted Solutions

Re: Create a sequence number and create buckets

Actually, this one is better

8 Replies
markgraham123
Valued Contributor

Re: Create a sequence number and create buckets

@sunny_talwar  Any of your help is highly appreciated!

Re: Create a sequence number and create buckets

Check attached

 

markgraham123
Valued Contributor

Re: Create a sequence number and create buckets

Sunny,

I first have to check for 16 order bucket. If i donot get 16, then i check for 8. Finally i apply '99999' value for those cant be bucketed in neither 16 nor 8.

Re: Create a sequence number and create buckets

What if Time 8 had more than 32 rows? Say 36 rows... what would it look like then?

markgraham123
Valued Contributor

Re: Create a sequence number and create buckets

Then it creates 2  - 16 order buckets and rest get '99999'

Re: Create a sequence number and create buckets

Not sure if this works always or not, but try this

Re: Create a sequence number and create buckets

Actually, this one is better

markgraham123
Valued Contributor

Re: Create a sequence number and create buckets

You are the best out of best, brother!!

 

Thanks a ton!! You solved my issue!!!

 

Thanks again 🙂 🙂