Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am reading multiple files in my qlikview load script like this
load *
from \\myserver\Files\TaskResult_*.xml (XmlSimple, Table is [Root])
There are hunderd of files in this directory. However, during one of the read, the script throw an error
General Script Error
I want to findout which file is it and what kind of data is inside this file. Since there are hundrd of files inside this directory, I want to know exactly which file is it. The Qlikview log only shows \\myserver\Files\TaskResult_*.xml (XmlSimple, Table is [Root])
Is there anyway to show which file is actually being read by the qlikview script?
Shah
When you load from an xml file you cannot use load *. You have to list the individual fields.
actually its working for me. The * does not seem to be the problem here as I am already loaded many other files like this. Even here, it has reloaded many files already.
Besides, the question is how to display the file name when we are loading files like this (does not matter whether xls, csv or any other such files)
Use the filename() function. It will return the name of the filename being processed. I reckon it will return only the first xml file and then the script will exit.
Hi,
Try using functions like
FileName() as FileName
or
FilePath () as FilePath
In your script and use the Field to track it .
Hope it helps !
Cheers !
I am with Gysbert. If * works for you the files must very simple. Are you sure they are loading something?
Any, to get the file name use FileBaseName() like this:
LOAD *,
FileBasename() As Filename,
...
It will be easier to see which file is failing if you use the For Each vFile in FileList('path') construct instead of the wild card load.
I have tried it like this
For Each vFile in ('$(QDS1DistributionSeviceDirectory)\TaskResults\*.xml')
TaskResultTemp:
LOAD TaskID,
OwnedByClusterID,
RunID,
TaskManuallyAborted,
PreviousRunHadErrors,
InternalError,
LastExecution,
Timestamp(Timestamp#(StartedAt,'DD.MM.YYYY hh:mm:ss')) as StartedAt,
Timestamp(Timestamp#(FinishedAt,'DD.MM.YYYY hh:mm:ss')) as FinishedAt,
MaxRunTime,
StartCount,
HasWarnings,
Status,
Modified,
%Key_Root_1C2F7E198516FFEA // Key for this table: Root
FROM $(vFile) (XmlSimple, Table is [Root])
where round(num(Date(Today()) - date(Floor(Timestamp#(StartedAt,'DD.MM.YYYY hh:mm:ss'))))) < '$(v#LogDays)';
NEXT;
However, its still showing
FROM \\fileserver1\qv11files\Qlikview Logs and settings\QDS\TaskResults\*.xml (XmlSimple, Table is [Root])
I was expecting to see the filename in the log. Ofcourse one way would be to load the filename in the table but I want to see the progress in the reload log
s i=0;
For Each vFile in ('$(QDS1DistributionSeviceDirectory)\TaskResults\*.xml')
s i=i+1;
let 'V$(i)'=vFile ;
TaskResultTemp:
LOAD TaskID,
OwnedByClusterID,
RunID,
TaskManuallyAborted,
PreviousRunHadErrors,
InternalError,
LastExecution,
Timestamp(Timestamp#(StartedAt,'DD.MM.YYYY hh:mm:ss')) as StartedAt,
Timestamp(Timestamp#(FinishedAt,'DD.MM.YYYY hh:mm:ss')) as FinishedAt,
MaxRunTime,
StartCount,
HasWarnings,
Status,
Modified,
%Key_Root_1C2F7E198516FFEA // Key for this table: Root
FROM $(vFile) (XmlSimple, Table is [Root])
where round(num(Date(Today()) - date(Floor(Timestamp#(StartedAt,'DD.MM.YYYY hh:mm:ss'))))) < '$(v#LogDays)';
NEXT;
you can inspect the variable value in the log file
Hi Syed, you can add messages to the log
For Each vFile in ('$(QDS1DistributionSeviceDirectory)\TaskResults\*.xml')
TRACE $(vFile);
...
Next
Hi
Did you manage to solve your issue?
Sasi