Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI expert,
I have CSV file which had a field name base date from 2015 to 2019 . i want to create multiple qvd based in Date field ,
LOAD
CAPNumber ,
Date(Base Date,'MM/DD/YYYY') as [Orginal Date],
From,,,,,
Store ---- into ----
Below is a small sample I created and hope this helps:
Data:
Load * Inline [
RecNo,Base_Date,Year,Amount
10,01/10/2015,2015,100
20,01/10/2016,2016,200
30,01/10/2017,2017,300
40,01/10/2018,2018,400
50,01/10/2019,2019,500
50,01/10/2019,2019,600
];
DistinctYearsTable:
LOAD Chr(39) & CONCAT(DISTINCT "Year",
Chr(39) & Chr(44) & Chr(39)) & Chr(39) AS DistinctYears
resident Data;
LET vDistinctYears = FieldValue('DistinctYears', 1);
DROP TABLE DistinctYearsTable;
FOR EACH vYear IN $(vDistinctYears)
CurrentYear:
NoConcatenate
LOAD * Resident
Data
WHERE Year = '$(vYear)';
STORE CurrentYear INTO 'C:\Temp\Data-$(vYear).qvd';
DROP TABLE CurrentYear;
NEXT
Drop Table Data;