Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I need to sum up the fieldnames in red: Opening Balance and sum, but they are in different tables. How can I do it? Currently the table clbal contains all variables from bal and clbal tables. The words in blue are the common variables.
load*,date(timestamp#(Date, 'YYYYMMDDhhmm')) as DATE;
bal:
LOAD Date,
storelocation AS StoreLocation,
Opening_Balance as openingbal
FROM
(txt, codepage is 1252, embedded labels, delimiter is '|', msq);
clbal:
load *,if(peek(StoreLocation)=StoreLocation,peek(openingbal),0) as Closing_Balance,
openingbal as Opening_Balance
resident bal order by StoreLocation,Date desc;
load *,sqlDate as DATE,
sqlStoreLocation as StoreLocation,
Receipts+Returns+transfer_out+transfer_in+
issue_from_store+intmxmp+return_to_store+[total_receipts-returns]+stock_adjustments+
adjustments_to_current_balance+loan_transfer_out+loan_transfer_in as sum;
Thanks.
Hi,
Check this script
bal:
LOAD Date,
storelocation AS StoreLocation,
Opening_Balance as openingbal
FROM
(txt, codepage is 1252, embedded labels, delimiter is '|', msq);
clbal:
load *,if(peek(StoreLocation)=StoreLocation,peek(openingbal),0) as Closing_Balance,
openingbal as Opening_Balance
resident bal order by StoreLocation,Date desc;
DROP TABLE bal;
LEFT JOIN (clbal)
load *,
sqlDate as DATE,
sqlStoreLocation as StoreLocation,
Receipts+Returns+transfer_out+transfer_in+
issue_from_store+intmxmp+return_to_store+[total_receipts-returns]+stock_adjustments+
adjustments_to_current_balance+loan_transfer_out+loan_transfer_in as sum
FROM Table2;
Regards,
Jagan.
Thanks, so where do I put the script to sum up the variables?
Hi,
Is
Receipts, Returns,transfer_out, transfer_in, issue_from_store, intmxmp, return_to_store, [total_receipts-returns], stock_adjustments, adjustments_to_current_balance, loan_transfer_out, loan_transfer_in
are variables?
If yes then do like this
load *,
sqlDate as DATE,
sqlStoreLocation as StoreLocation,
$(Receipts)+$(Returns)+$(transfer_out)+$(transfer_in)+
$(issue_from_store)+$(intmxmp)+$(return_to_store)+$([total_receipts-returns])+$(stock_adjustments)+
$(adjustments_to_current_balance)+$(loan_transfer_out)+$(loan_transfer_in) as sum
FROM TableName;
Hope this helps you.
Regards,
Jagan.
I meant opening balance and sum