Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
I'm getting data from Excel like following and after every two days excel will replaced by new same excel same table. But for checkpoint purpose I'll find that whether I'm getting new fields in new data or some fields are missing as compared to old table.
Data:
LOAD
Date,
Source_No,
EMP_ID,
CountryID,
Level
FROM
[$(vSource_Data)\Data*.csv]
(txt, codepage is 1235, embedded labels, delimiter is ',', msq);
How do I catch the difference?
AND if the table is same as compared to old one i'll move this source Excel on another location.
Will appreciate help !!
We can check with previously loaded table. following table is the original table which I have already loaded in Qlikview. new excel has to be same as like previous one. but sometime columns may get changed. in that case I need these check points
Data:
LOAD
Date,
Source_No,
EMP_ID,
CountryID,
Level
FROM
[$(vSource_Data)\Data*.csv]
(txt, codepage is 1235, embedded labels, delimiter is ',', msq);
You can use above script and scripterrormode variable at time and have list of mismatch in other table with tablename.
Let vTableName = TableName(0);
Let vNoOfColumns = NoOfFields('$(vTableName)');
Trace $(vTableName);
Let vFieldList = '';
for i = 1 to $(vNoOfColumns)
vFieldList = vFieldList&','&chr(39)&FieldName($(i),'$(vTableName)')&chr(39);
next i;
vFieldList = right((vFieldList),len(vFieldList)-1);
Trace $(vFieldList);
for i = 1 to $(vNoOfTable)-1
Let vTableName = TableName($(i));
Let vNoOfColumns = NoOfFields('$(vTableName)');
Trace $(vNoOfColumns);
for j=1 to $(vNoOfColumns)
vFieldName = FieldName($(j),'$(vTableName)');
vFieldCheck = WildMatch('$(vFieldName)',$(vFieldList));
if $(vFieldCheck) = 0 then
Load
'$(vFieldName)' as MisMatch_Field,
'$(vTableName)' as MisMatch_TABLE_NAME
AutoGenerate(1);
ENDIF
Trace $(vTableName) -> $(vFieldName);
next j;
next i;
I see your format is correct and logical
How can I store information in .txt format for mismatch fields in certain table in above code?
can you just tell me where I need to modify ?
You just need to store Table into txt as below.
Give table name
MisMatch:
Load
'$(vFieldName)' as MisMatch_Field,
'$(vTableName)' as MisMatch_TABLE_NAME
AutoGenerate(1);
and last statement after next i;
Store MisMatch into MisMatch.txt(txt);
Let me know in case of any issue.