Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select specific lines

Hi

I have 2 tables , one is ORDER and another for INVOICE.  Once an order is invoiced, the lines in the "Invoice" Table replaces the lines in the "Order" Table.

However i want to look at orders that are not invoiced at all, hence I have combined the 2 tables , by concatenating the "Order" table to the "Invoice" table and thereafter dropping the "Orders" table as shown below.

  

Concatenate ([INVOICE])

Load * Resident [ORDER];

drop table [ORDER];

When an order is invoiced , it generates an invoice number, otherwise invoice number  its shown as "****NEW***. 

  • When an item in the order is fully invoiced, the line in the order table is replaced with the line in the invoice table.
  • However if an item is partially invoiced or not invoiced, then same item appears twice.

I only want to show the line that appears in the invoice table and the line in the order table to fall off. 

How do i do this in the scripting.

See attached excel .  Those lines that are highlighted I want them to fall away. 

kind regards

Nayan

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Remove all of the script and replace it with what I posted in my previous post. See attached files.


talk is cheap, supply exceeds demand

View solution in original post

11 Replies
Gysbert_Wassenaar

Doesn't adding a where clause to the load of the Invoice table do what you want?

Invoice:

Load *

from ....

where INVNUMBER <> '*** NEW ***' ;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert

The ***NEW*** comes from the order table.  I dont want to exclude ***NEW*** because I also want to view new  orders outstanding.

Below is the order table, invoice table and combined table. In the combined table i want the duplicate entry remove.

Sorry for showing the table below, as i cannot attached the excel file.

Many thanks

kind regards

Nayan

ORDER TABLE
ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00120121105*** NEW ***AOutstanding50000
ORD-00120121105*** NEW ***BOutstanding10000
ORD-00120121105*** NEW ***COutstanding1200
ORD-00120121105*** NEW ***DOutstanding1200
ORD-00120121105*** NEW ***EOutstanding500
ORD-00120121105*** NEW ***FOutstanding500
ORD-00120121105*** NEW ***GOutstanding6000
ORD-00120121105*** NEW ***HOutstanding6000
ORD-00120121105*** NEW ***IOutstanding2000
ORD-00120121105*** NEW ***JOutstanding12000
ORD-00120121105*** NEW ***KOutstanding10800
ORD-00120121105*** NEW ***LOutstanding60000
ORD-00120121105*** NEW ***MOutstanding1400
INVOICE TABLE
ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00120121105INV-002APartially Invoiced500306194
ORD-00120121105INV-002BOutstanding1000100
ORD-00120121105INV-002CComplete12120
ORD-00120121105INV-002DOutstanding12012
ORD-00120121105INV-002EOutstanding505
ORD-00120121105INV-002FOutstanding505
ORD-00120121105INV-002GComplete60600
ORD-00120121105INV-002HOutstanding60060
ORD-00120121105INV-002IOutstanding20020
ORD-00120121105INV-002JComplete1201200
ORD-00120121105INV-002KComplete1081080
ORD-00120121105INV-002LOutstanding6000600
ORD-00120121105INV-002MComplete14140
COMBINED TABLE
ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00120121105INV-002APartially Invoiced500306194
ORD-00120121105*** NEW ***AOutstanding1940194
ORD-00120121105INV-002BOutstanding1000100
ORD-00120121105*** NEW ***BOutstanding1000100
ORD-00120121105INV-002CComplete12120
ORD-00120121105*** NEW ***DOutstanding12012
ORD-00120121105INV-002DOutstanding12012
ORD-00120121105*** NEW ***EOutstanding505
ORD-00120121105INV-002EOutstanding505
ORD-00120121105*** NEW ***FOutstanding505
ORD-00120121105INV-002FOutstanding505
ORD-00120121105INV-002GComplete60600
ORD-00120121105INV-002HOutstanding60060
ORD-00120121105*** NEW ***HOutstanding60060
ORD-00120121105INV-002IOutstanding20020
ORD-00120121105*** NEW ***IOutstanding20020
ORD-00120121105INV-002JComplete1201200
ORD-00120121105INV-002KComplete1081080
ORD-00120121105INV-002LOutstanding6000600
ORD-00120121105*** NEW ***LOutstanding6000600
ORD-00120121105INV-002MComplete14140
Gysbert_Wassenaar

I think I figured out what you are trying to do. It's a bit more complicated than just selecting some lines. Can you check the attached qvw to see if it does what you want?


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert

Thanks for your reply. Not quite.

In this example , the lines containing invoice number  " ***NEW*** " should not appear.  The ideal result for the combined Table 3 below is below .   Coincidentally, in this example  it is a same as the invoice table.

Lets just say there is an new order (say, ORD-002) , see Table 1 below: 

Now, this order has not been invoiced as all, then the result shuold be as follows:  See Table 2: . 

Please note that the "Combined Table" is my results table.  The answer i'm looking for .

kind regards

Nayan

Table 1:  (Order Table)

ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00220121105*** NEW ***XOutstanding8000800
ORD-00220121105*** NEW ***YOutstanding60060
ORD-00220121105*** NEW ***ZOutstanding1000100

Table 2:  (Combined Table)

ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00220121105*** NEW ***XOutstanding8000800
ORD-00220121105*** NEW ***YOutstanding60060
ORD-00220121105*** NEW ***ZOutstanding1000100

Table 3: (Combined Table)

ORDNUMBERINVDATEINVNUMBERItemStatusQty OrderedQty InvoicedQty BackOrder
ORD-00120121105INV-002APartially Invoiced500306194
ORD-00120121105INV-002BOutstanding1000100
ORD-00120121105INV-002CComplete12120
ORD-00120121105INV-002DOutstanding12012
ORD-00120121105INV-002EOutstanding505
ORD-00120121105INV-002FOutstanding505
ORD-00120121105INV-002GComplete60600
ORD-00120121105INV-002HOutstanding60060
ORD-00120121105INV-002IOutstanding20020
ORD-00120121105INV-002JComplete1201200
ORD-00120121105INV-002KComplete1081080
ORD-00120121105INV-002LOutstanding6000600
ORD-00120121105INV-002MComplete14140
Gysbert_Wassenaar

Try this then:

Combined:

load *,  ORDNUMBER&Item as Key

FROM .....;

Concatenate

LOAD *

FROM ....  where not exists(Key,ORDNUMBER&Item);

drop Field Key;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert

When i type in concatenate, it has a red underline .  By the way, im new at Qlikview and sure on the scripting.

kind regaqrds

Nayan

Gysbert_Wassenaar

Keep typing. As soon as you type LOAD after concatenate the red underline will disappear.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert

Thanks .  I've copied the file onto my desktop  .   Split the invoice table and order table into seperate sheets. 

However I can't seem to get the script working.  Below is the scripting.  Can you tell me where I am going wrong. 

Thanks .

By the way, im on my way hoem, will have a look tomorrow morning.

kind regards

Nayan

Temp:
LOAD ORDNUMBER&Item as Key,
[Qty BackOrder] as QBO
FROM
C:\Users\nayan.lalla\Desktop\comm67010.xlsx
(biff, embedded labels, table is [Invoice])
where Status <> 'Complete';

left join
LOAD
     ORDNUMBER&Item as Key,
     ORDNUMBER,
     INVDATE,
     INVNUMBER,
     Item,
     Status,
     [Qty Ordered],
     [Qty Invoiced],
     [Qty BackOrder]
FROM
C:\Users\nayan.lalla\Desktop\comm67010.xlsx
(biff, embedded labels, table is [Order]);

Combined:
load
     ORDNUMBER,
     ORDNUMBER&Item as Key,
     INVDATE,
     INVNUMBER,
     Item,
     Status,
     QBO as [Qty Ordered],
     [Qty Invoiced],
     QBO as [Qty BackOrder]
Resident Temp;    

drop table Temp;

load *
FROM
C:\Users\nayan.lalla\Desktop\comm67010.xlsx
(biff, embedded labels, table is [Invoice]);

Concatenate

LOAD *
FROM
C:\Users\nayan.lalla\Desktop\comm67010.xlsx
(biff, embedded labels, table is [Invoice]);

Drop Field Key;

Gysbert_Wassenaar

Remove all of the script and replace it with what I posted in my previous post. See attached files.


talk is cheap, supply exceeds demand