Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

show filename that is being read in the qlikview script

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

10 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

When you load from an xml file you cannot use load *. You have to list the individual fields.


talk is cheap, supply exceeds demand
Not applicable
Author

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)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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.


talk is cheap, supply exceeds demand
Not applicable
Author

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 ! 

 

jonathandienst
Partner - Champion III
Partner - Champion III

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.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

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

sasiparupudi1
Master III
Master III

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

rubenmarin1

Hi Syed, you can add messages to the log

For Each vFile in ('$(QDS1DistributionSeviceDirectory)\TaskResults\*.xml') 

     TRACE $(vFile);

     ...

Next

sasiparupudi1
Master III
Master III

Hi

Did you manage to solve your issue?

Sasi