Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Shady
Contributor
Contributor

Handling non-existent columns

I am trying to read through multiple qvd files and checking the max value of a particular date field.

 

sub Member(Filename)
if FileSize(Filename) > 0 then
TempTable:
LOAD *
FROM [$(Filename)](qvd);

AutoNumberQVDDate:
LOAD DISTINCT QVDDate
Resident TempTable;
AutoNumber1:
LOAD max(QVDDate) AS Key
Resident AutoNumberQVDDate;

let maxDate = PEEK('Key',0,'AutoNumber1');

endif

but some qvd files do not have QVDDate in them and have some other date like dss_create_date, so I modified my code to below:

sub Member(Filename)
if FileSize(Filename) > 0 then
TempTable:
LOAD *
FROM [$(Filename)](qvd);

AutoNumberQVDDate:
LOAD DISTINCT QVDDate
Resident TempTable;
AutoNumber1:
LOAD max(QVDDate) AS Key
Resident AutoNumberQVDDate;

let maxDate = PEEK('Key',0,'AutoNumber1');

If (IsNull(maxDate)) then

AutoNumberQVDDate:
LOAD DISTINCT dss_create_date
Resident TempTable;
AutoNumber1:
LOAD max(dss_create_date) AS Key
Resident AutoNumberQVDDate;

endif

I am getting error "File not found table not found", how do I make it work, short of writing seperate functions for each date value.

 

Labels (1)
2 Replies
Saravanan_Desingh

May be you can use ErrorMode variable. If it set to zero, the errors will be muted. Once the process done, set it back to 1.

Brett_Bleess
Former Employee
Former Employee

Here is a Help link related to what Saran mentioned:

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Error...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.