Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Morning Friends,
I have set of QVDs having data from same table, but column structure of qvd's are different. Few of QVDs has 10 columns & few has 15 columns. First 10 columns are same in both cases & later 5 columns being added to new data. For Historic data , structure didn't changed. Here my question is how to load all of them into a single QVD ?
Hi,
Try this
SET vIndex = 1;
FOR EACH file in FileList('filepath\*.qvd');
IF vIndex = 1 THEN
Data:
LOAD
*
FROM $(file) (qvd);
ELSE
Concatenate(Data)
Load * ,
From $(file) (qvd);
ENDIF
LET vIndex = vIndex + 1;
Next
HI,
Try like this
Data:
LOAD
Column1,
Column2,
'
'
'
'
Column15
Autogenerate 0;
Concatenate(Data)
LOAD
*
FROM *.qvd (qvd);
Note: Replace Column1, Column2, ..... Column15 with your actual column names.
If this is not working then use loop to read each and every file.
FOR EACH file in FileList('filepath\*.qvd');
Data:
LOAD
Column1,
Column2,
'
'
'
'
Column15
Autogenerate 0;
Concatenate(Data)
Load * ,
From $(file) (qvd);
Next
Regards,
Jagan.
Thanks Jagan. Is there a way to do same without mentioning column names ? In feature if somebody adds new column to source without the help of developer it should work.
BTW I will check the above code.
Hi,
If your done with all QVD's Transformations then,
Test_QVD:
Load *
From
; Store Test_QVD into [TEST\Final.QVD];
Hope this Helps,
Hirish
This will not work, since structure is different it will create 2 tables
try like this..
LOAD * FROM QVD_Path\*.qvd (qvd);
Why not concatenate them??
And use a common Flag to differentiate all the tables??
How to concatenate ? I don't know from which QVD the structure is going to change ? I am looking for generic solution.
Hi,
Try this
SET vIndex = 1;
FOR EACH file in FileList('filepath\*.qvd');
IF vIndex = 1 THEN
Data:
LOAD
*
FROM $(file) (qvd);
ELSE
Concatenate(Data)
Load * ,
From $(file) (qvd);
ENDIF
LET vIndex = vIndex + 1;
Next
As per you, Set of QVDs from same table. It seems you are creating multiple QVDs from same Table with different different conditions, Is it right??
Now Say, I am having a table XXX, and I am going to drive two tables from this which is: XXX1, XXX2
XXX1:
Load
A,
B,
'XXX1' as Flag
Resident XXX;
Concatenate(XXX1)
XXX2:
Load
B,
C,
D,
'XXX2' as Flag
Resident XXX;
and so on...What would be the issue in this case??
Drop table XXX;