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

Creating a new order number

Hi Friends,

we got many data from our machines and we want to make a report.

I have a table for example with this data:

Timestamp

Program Number

(is specific for a Material and not a order number)

20.08.2015 06:00:00

64

20.08.2015 06:10:0064
20.08.2015 07:00:0064
20.08.2015 07:30:0064
...
21.08.2015 01:00:0064
21.08.2015 01:10:0022
21.08.2015 01:30:0022
...22
21.08.2015 10:10:0022
...
30.08.2015 14:10:0064
...

We want now to see, which productions are in the same order number and which are new.

The new table should be like this: Date is the first time when this Order started:

Date

Program Number

(is specific for a Material and not a order number)



Order Number

20.08.2015

64

1
21.08.2015222
30.08.2015

64

3

How can I do this? I have tried it with the peek function, but it does not work.

Thx

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

if i understood your request it should be something like this

after loading the table will call it DataTemp

your script should be something like this

Data:

Load *,

         if(previous([Program Number])=Program Number,peek('[Order Number]'),Rangesum(peek('[Order Number]'),1)) As [Order Number]

resident DataTemp

order by Date;


drop table Data

you need to use resident, so you'll be able to use Order by


View solution in original post

5 Replies
Anil_Babu_Samineni

This looks like you need Rowno() and Min(ProgramNo) for expressions?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
lironbaram
Partner - Master III
Partner - Master III

if i understood your request it should be something like this

after loading the table will call it DataTemp

your script should be something like this

Data:

Load *,

         if(previous([Program Number])=Program Number,peek('[Order Number]'),Rangesum(peek('[Order Number]'),1)) As [Order Number]

resident DataTemp

order by Date;


drop table Data

you need to use resident, so you'll be able to use Order by


arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Ibrahim,

Use Timestamp# Function and load distinct records you may get output.

Thanks,

Arvind Patil

PrashantSangle

Hi,

Try Using floor() to make one date then using firstsortedValue() you can use first value from table.

For details search in community or help menu.

Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tiklabaq
Creator
Creator
Author

Thank you very much Liron, this is gooood

Is the 1 after the , for the first Row in the table? If that's true, then I've understood it

And thanks to all the others who have replied. You are great!