Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I have a load statement like
[Txn]:
Load
TxnId,
From invoice.qvd(qvd);
Concatenate(Txn)
Load
TxnId,
From SalesReceipt.qvd(qvd);
These QVD files have only one column.
But I want my table to look like this
TxnType TxnId
Invoice, 1
Invoice, 2
SalesReceipts 3
So it means I need to insert a hard coded value for each Load;
something like this
[Txn]:
Load
TxnId,
"Invoice" as TxnType
From invoice.qvd(qvd);
Concatenate(Txn)
Load
TxnId,
"SalesReceipt" as TxnType
From SalesReceipt.qvd(qvd);
But obviously it will not work becasue it will not find Invoice or SalesReceipt column in respective QVD files.
How to do this?
Thanks,
Saurabh
Hello Saurabh,
I think you answered your own question as the last example should work ok.
You may need to replace the double quotes with a single quote, but you will end up with a new field called TxnType with either 'Invoice' or 'SalesReceipt' as the value.
Hello,
if the above solution does not work, I would try:
[TxnTemp]:
Load
TxnId,
From invoice.qvd(qvd);
[Txn]:
Load
*,
"Invoice" as TxnType resident TxnTemp;
drop table TxnTemp;
[TxnTemp]:
Load
TxnId,
From SalesReceipt.qvd(qvd);
Load
*,
"SalesReceipt" as TxnType resident TxnTemp;
drop table TxnTemp;
HTH.
Hello Saurabh,
I think you answered your own question as the last example should work ok.
You may need to replace the double quotes with a single quote, but you will end up with a new field called TxnType with either 'Invoice' or 'SalesReceipt' as the value.
Hi
Your script is fine except that Invoice and SalesReceipt should be in single quotes.
Regards
Jonathan
Hi,
considering peter's answer your script looks like :
[Txn]:
Load
TxnId,
'Invoice' as TxnType
From invoice.qvd(qvd);
Concatenate(Txn)
Load
TxnId,
'SalesReceipt' as TxnType
From SalesReceipt.qvd(qvd);
Thanks Peter!
It works.
Thanks Jonathan,
It works.
I marked Peter's answer as correct because I got his reply earlier than yours.