Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a generator which generates QVDS on daily basis with date appended to filename
eg
xyz_20171001
xyz_20171002
xyz_20171003 and so on.
Stored at same folder
Then I have a DM where in I am calling each QVD, performing some transformations.And then creating 1 QVD out of it.
Then in my application I am using this newly created QVD.
Question:
I want to show 3 new columns in Application. So if I add them from today then DM will fail saying columns are not available in QVDs created previously.
I dont want to have those columns in old Qvds but new Qvds should have them.
Please suggest.
Please let me know if I am not clear.
You can create another qvw that
And then backup the old ones replace with the new
You can load into your DM the old QVDs and create these new columns(fields) with null() (or 0) values (doing this your old QVDs have the original structure) and then concatenate the new QVDs where the new columns are present.
XYZ:
Load
*,
null() as NewColumn1,
null() as NewColumn2,
null() as NewColumn3
from OldQVDxyz_2017*.qvd(qvd);
Concatenate(XYZ)
Load
*
from NewQVD.qvd(qvd);
What if I have 250 Old QVDs
and what if in future I have to add 3 more columns to the newly generated QVDs.
eg.
Set 1:From 1st to 10th old QVDs
Set 2: From 11th to 20th new QVDs with 3 new columns
Set 3: From 21st to 30th new QVDs with 3 new columns
Now set 1 has 6 columns missing
set 2 has 3 columns missing
I don't want to change structure of old QVDs if possible.So do not want to recreate them.
There´s a workaround so, please make the necessary changes
QvdFieldHeader:
LOAD FieldName FROM [yourqvd.qvd] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]) where FieldName = 'SERVICE TYPE ID'; // put your new field here
Let code=If(NoOfRows('QvdFieldHeader') > 0,'[SERVICE TYPE ID],','null() AS [SERVICE TYPE ID],'); // Change accordingly to your fields
Load
field1,
field2,
$(code)
From [yourqvd.qvd] ;
How are you reading your QVDs in the DM? With wildcard syntax?
-Rob
I am using For Loop to read each QVD.
Hi
Using If condition into For Loop
For each filename in filelist //fine name format Xyz_YYYYMMDD
if num(right($(filename),2)) <=10 then //set 1
// add 6 columns missing
load *, null() as Col_1,null() as Col_2...null() as Col_6
resident filename;
else if num(right($(filename),2)) <=20 //set 2
//add 3 columns missing
load *, null() as Col_4,null() as Col_5...null() as Col_6
resident filename;
else
// load QDD set 3
load *
resident filename;
end if;
end if;
loop;
Regards
Will it work if we do not know the number of columns that we are going to add or name of columns?
And what if we might have to add few columns in future..