Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jumiprado
Creator
Creator

[Scripting] Get new Field

Billing
ClientID
Bill_ID
Period
Amount
Bill_Type
Date_Billing

I give an example for BILLING table:

ClientIDBill_ID Period Amount Bill_Type BILL_CANCEL Date_Billing
Client_001BILL_0001may-15100Bill001/05/2015
Client_002BILL_5030Apr-201540Bill004/04/2015
Client_002Bill_5043Apr-2015-20Credit NoteBILL_503006/04/2015
Client_003BILL_6074jun-1550Bill007/06/2015
Client_001BILL_0001jul-15-30Credit NoteBILL_000105/07/2015

Collection
ClientID
PaymentID

Period

Amount
Payment_Type
Date_Collection

ClientIDPaymentIDPeriodAmountPayment_TypeDate_Collection
Client_001P_3059May-201580Payment04-05-2015
Client_002P_5492Apr-201520Payment07-04-2015
Client_003P_8765Jun-201550Payment14-06-2015

I Need to create a new table similar to this:

ClientIDBill_ID Period Amount BILL_CANCELPERIOD_CANCELDate_Billing
Client_001BILL_0001may-151000001/05/2015
Client_002BILL_5030Apr-2015-200004/04/2015
Client_002Bill_5043Apr-2015-20BILL_5030Apr-201506/04/2015
Client_003BILL_6074jun-15500007/06/2015
Client_001BILL_0899jul-15-30BILL_0001may-1505/07/2015

Thanks youu!

1 Reply
Peter_Cammaert
Partner - Champion III
Partner - Champion III

In your script, create a Bill_Cancel table with some code like this:

BILL_Cancel:

LOAD BILL_ID AS BILL_CANCEL,

     Period AS PERIOD_CANCEL

RESIDENT Billing

WHERE BILL_Type = 'Credit Note';

Reload and add field PERIOD_CANCEL to your main dashboard object. Associative logic will perform its magic.

If you need this PERIOD_CANCEL field as an extra column in the internal Billing table itself, convert BILL_Cancel into a Mapping table, transfer Billing into a second resident table and at the same time use

:

applymap('BILL_Cancel', BILL_CANCEL, 0) AS PERIOD_CANCEL,

:

Best,

Peter