Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
tizianacaem
Partner - Contributor
Partner - Contributor

Data Processing with comand Previous

Hi all,

I have some production data to be processed.

Each work-order consists of several operations, indicated by a number, which is not necessarily a progressive continuum (eg work-order 100, operations 1,3,8 work-orders 101, operations, 1,5, 7 etc. ). There is a sequence number, which indicates the sequence in which the operations are done in the same work-order.

For each operation I have an end date but no start date. The start date of an operation, however, could be represented by the end date of the previous operation, within the same work-order.

I tried to insert the following statement in the script, but it doesn't work.

OPERATIONS:
load *
PREVIOUS (OPERATION_DATA_END) AS OPERATION_DATA_START;
LOAD *
FROM OPERATION.QVD (QVD) order by OPERATION_WORK_ORDER, OPERATION_NUMBRE_SEQUENCE;

Someone have any ideas???

thanks

Tiziana

1 Solution

Accepted Solutions
Not applicable

Hi Tiziana,

The problem in this Order By command, you need to load a resident to use the command Order By, try this:


TMP_OPERATIONS:
LOAD *
FROM OPERATION.QVD (QVD) order by OPERATION_WORK_ORDER,OPERATION_NUMBRE_SEQUENCE;
OPERATIONS:
load
*,
PREVIOUS (OPERATION_DATA_END) AS OPERATION_DATA_START
RESIDENT TMP_OPERATIONS
order by OPERATION_WORK_ORDER,OPERATION_NUMBRE_SEQUENCE;
drop table TMP_OPERATIONS;


View solution in original post

3 Replies
Not applicable

Hi Tiziana,

The problem in this Order By command, you need to load a resident to use the command Order By, try this:


TMP_OPERATIONS:
LOAD *
FROM OPERATION.QVD (QVD) order by OPERATION_WORK_ORDER,OPERATION_NUMBRE_SEQUENCE;
OPERATIONS:
load
*,
PREVIOUS (OPERATION_DATA_END) AS OPERATION_DATA_START
RESIDENT TMP_OPERATIONS
order by OPERATION_WORK_ORDER,OPERATION_NUMBRE_SEQUENCE;
drop table TMP_OPERATIONS;


tizianacaem
Partner - Contributor
Partner - Contributor
Author

Thanks, now it work correctly.

I just deleted the order by from the TMP_OPERATIONS.

Bye

Not applicable

Ok,

I forgot to remove the order by.