Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
We are loading application with two tables Table A & Table B. if Table A missing, the application will pop up an error like "cannot open file" but this should not happen. Application should ignore this error and continue it's execution
I am using below code to avoid this error but it's not working
set ErrorMode = 0;
Query_Target:
LOAD
Consignment_No,
Track_No,
Packet_Id,
Barcode_Status,
Destination,
Shipment
FROM [lib://AttachedFiles/Query Target.xlsx]
(ooxml, embedded labels, table is Sheet1);
set ErrorMode = 1;
Query_Status:
LOAD
statuscode,
description,
resolution
FROM [lib://AttachedFiles/Query Status.xlsx]
(ooxml, embedded labels, table is Sheet1);
Currently Query Target Table is not available but application should not through an error I am using Set ErrorMode but it's not working below error is coming
is there any alternate way to achieve my requirement. Could some one help me on this
Thanks,
Satya
Hey @SatyaPaleti , you could try something like this:
if IsNull(filesize('[lib://AttachedFiles/Query Target.xlsx]')) = -1 then
LET vExistFile = 0;
else
LET vExistFile = 1;
endif;
if '$(ExistFile)' then
Query_Target:
LOAD
Consignment_No,
Track_No,
Packet_Id,
Barcode_Status,
Destination,
Shipment
FROM [lib://AttachedFiles/Query Target.xlsx]
(ooxml, embedded labels, table is Sheet1);
endif
Query_Status:
LOAD
statuscode,
description,
resolution
FROM [lib://AttachedFiles/Query Status.xlsx]
(ooxml, embedded labels, table is Sheet1);
Hey @SatyaPaleti , you could try something like this:
if IsNull(filesize('[lib://AttachedFiles/Query Target.xlsx]')) = -1 then
LET vExistFile = 0;
else
LET vExistFile = 1;
endif;
if '$(ExistFile)' then
Query_Target:
LOAD
Consignment_No,
Track_No,
Packet_Id,
Barcode_Status,
Destination,
Shipment
FROM [lib://AttachedFiles/Query Target.xlsx]
(ooxml, embedded labels, table is Sheet1);
endif
Query_Status:
LOAD
statuscode,
description,
resolution
FROM [lib://AttachedFiles/Query Status.xlsx]
(ooxml, embedded labels, table is Sheet1);
Thank you so much for your response and it's working as expected. but it's working when we are loading excel data but when we are loading data from db still it showing null
if IsNull(filesize('[lib://AttachedFiles/Query Target.xlsx]')) = -1 this point working for excel
if IsNull(filesize('"air_prod"."air_edc_dv"')) =-1 still it showing null even data is available
is there any alternate way to make it not null?
Thanks,
Satya
Hello @SatyaPaleti, the filesize() function returns an integer containing the size in bytes of the file filename or, if no filename is specified, of the table file currently being read. You are getting null probably because the argument you are passing to the function is not a file name. Maybe this thread could help you.