Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
danilodct
New Contributor III

Check itens included in other table

I have two tables called BILL and PAYMENT.

How can i create in BILL table a column to indicate only the bills that has a payment in PAYMENT table associated?

Tags (1)
1 Solution

Accepted Solutions

Re: Check itens included in other table

Same with mapping table. Usually much faster...


PAYMENT:

LOAD BillID, ..... // Load everything you need

FROM DataSource (options);

MapHasPayment:

MAPPING LOAD DISTINCT BillID, 'Y' AS F2 RESIDENT PAYMENT;

BILL:

LOAD BillID,

     applymap('MapHasPayment', BillID, 'N') AS HasPaymentFlag,

     .... // Load everything you need

FROM OtherDataSource (options);

No need to drop Mapping Table. Disappears automatically at the end of the script run

2 Replies
MVP
MVP

Re: Check itens included in other table

In your load script you could do this:

PAYMENT:

LOAD

     BillNo,

     .....

FROM      // or ;SQL SELECT ...

     .....;

HAS_PAYMENTS:

LOAD DISTINCT

     PaymentBillNo

RESIDENT

     PAYMENT;

BILL:

LOAD

     BillNo,

     If( Exists('PaymentBillNo') , 'Y' , 'N') AS HasPayments,

     ....

FROM        // or ;SQL SELECT ....

     .....;

DROP TABLE HAS_PAYMENTS;

Re: Check itens included in other table

Same with mapping table. Usually much faster...


PAYMENT:

LOAD BillID, ..... // Load everything you need

FROM DataSource (options);

MapHasPayment:

MAPPING LOAD DISTINCT BillID, 'Y' AS F2 RESIDENT PAYMENT;

BILL:

LOAD BillID,

     applymap('MapHasPayment', BillID, 'N') AS HasPaymentFlag,

     .... // Load everything you need

FROM OtherDataSource (options);

No need to drop Mapping Table. Disappears automatically at the end of the script run

Community Browser