If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
Hi all,
Something weird is happening; I hope you'll be kind enough to help.
Here's what I've done :
I have a BIG qvd which became corrupted and it's impossible to store data in it (the script fails):
So i've splited it into different QVDs by year :
here's the code to do so :
Let vField = Peek('Field',$(i), 'TABLE_MSEG_Z600');
Let vNomTable = Peek('Table',$(i), 'TABLE_MSEG_Z600');
//I CALL THE TABLE
$(vNomTable):
LOAD *
FROM $(vCheminSourcesDonnees_QVD_SAP_Donnees)$(vDomain)\$(vNomTable).QVD (qvd);
// I define the min and max year within the table
MinMax:
LOAD Distinct MJAHR as YEAR_MSEG_Z600 Resident $(vNomTable);
Min:
load min(YEAR_MSEG_Z600) as MIN_YEAR_MSEG_Z600 Resident MinMax;
Max:
load max(YEAR_MSEG_Z600) as MAX_YEAR_MSEG_Z600 Resident MinMax;
let vMinYEAR_MSEG_Z600= peek('MIN_YEAR_MSEG_Z600',0,'Min');
let vMaxYEAR_MSEG_Z600= peek('MAX_YEAR_MSEG_Z600',0,'Max');
DROP Table MinMax;
// I store the qvd into qvds by year
For j=$(vMinYEAR_MSEG_Z600) to $(vMaxYEAR_MSEG_Z600)
$(vNomTable)_$(j):
NoConcatenate
load *,1 as FlagExists Resident $(vNomTable) Where MJAHR=$(j);
STORE $(vNomTable)_$(j) into $(vCheminSourcesDonnees_QVD_SAP_Donnees)$(vDomain)\$(vNomTable)_$(j).QVD (qvd);
drop table $(vNomTable)_$(j);
next j;
Result:
The problem is : I have the same number of lines.. BUT in the next application, when I change my code from :
load * FROM $(vCheminQVD)01_SAP\02_Data\039_MATERIAL_DOC\Z600.qvd (qvd)
into
load * FROM $(vCheminQVD)01_SAP\02_Data\039_MATERIAL_DOC\Z600_*.qvd (qvd)
I have different results while I have always the same number of lines!
Any ideas? I'm really confused..
Thanks
What sort of expressions give different results?
I would expect you could chunk the QVD much quicker by looping for each year (without peeking) and then load with a where exists:
for iMJAHR = 2012 to 2022
tmpYear:
LOAD $(iMJAHR) as MJAHR AUTOGENERATE 1;
tmpNextFile:
LOAD * FROM [$(vCheminSourcesDonnees_QVD_SAP_Donnees)$(vDomain)\$(vNomTable).QVD] (qvd)
WHERE EXISTS (MJAHR);
if alt(NoOfRows('tmpNextFile'), 0) > 0 then
STORE tmpNextFile INTO [$(vCheminSourcesDonnees_QVD_SAP_Donnees)$(vDomain)\$(vNomTable)_$(iMJAHR).QVD ] (qvd);
DROP TABLE tmpNextFile;
end if
next
I can't see how that would give you a different result when loading from the chunked up file as from the large QVD.
The only thing I can think is that whatever has caused the original QVD to become corrupted is causing the issue.
Hope that helps.
Steve