Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
toddbuss
Creator
Creator

Data Load trick: Insert date from filename into field

On my Qlik Sense data load, I'm able to import several excel documents, but I need to insert a field on every record that holds a date-stamp that is only available in the file name.  The code below inserts nulls into the ReportDate fields.  I realize i'll need to massage the formatting of the field so that it's a date, but I'd like to succeed at importing the value as text before I clean it up.  Am I on the right track?

[Bed Survey]:

LOAD

    @1 as Region,

    @2 as [Facility Code],

    @3 as [Facility Name],

    @4 as [Bed Number],

    ...(etc)...

    AutoNumber(RowNo(),[@4]) as [Line Number],

  right('$(file)',11) as ReportDate

   

FROM [lib://Conn_HealthServicesData (central_office_oconrkt)/Inpatient Beds\*.XLS]

(txt, codepage is 1252, no labels, delimiter is '\t', msq, header is 1 lines);

Thanks,

Todd

1 Solution

Accepted Solutions
sunny_talwar

May be try this

Right(FileBaseName(), 10) as ReportDate

View solution in original post

3 Replies
sunny_talwar

May be try this

Right(FileBaseName(), 10) as ReportDate

toddbuss
Creator
Creator
Author

Thanks!  That was simple enough.  Do you know where I might find a list of pre-defined variables like FileBaseName?  For example, Is there a system variable for the file's save-dates? (from windows).

sunny_talwar

Check here for some file related functions

File functions ‒ QlikView

For save date, may be this

FileTime ‒ QlikView