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

Date

Hi,

I'm bringing in a series of Excel Spreadsheets into a Qlikview document but the spreadsheets don't have a date column. I would like to add a date column but it needs to reflect the name of each workbook. So, I have files called - "Info WC 01-04-16", "Info WC 08-04-16", "Info WC 15-04-16" and so on. It's the WC date I need to create. An added complication is that I concatenate each new file on a weekly basis, so I'm just looking for the newest file in the folder and adding it the bottom of the current data.

Make sense?

Kev

12 Replies
sunny_talwar

Try this in your load statement

LOAD AllFieldNames,

          Date(Date#(Right(BaseFileName(), 8), 'DD-MM-YY')) as Date

FROM SourceFile;

kevbrown
Creator II
Creator II
Author

Thanks but it states Bad field name BaseFIleName. Is that because it should be my file name in there?

kevbrown
Creator II
Creator II
Author

Thanks,

Filename is now in my date but can i trim it to only include the date part. Currently it states Info WC 15-04-16.xls

sunny_talwar

BaseFileName() is a function which picks the information from the the file name from which you are loading the data.

MK_QSL
MVP
MVP

Use same function provided by Sunny T.

kevbrown
Creator II
Creator II
Author

IT's not liking the Brackets after BaseFileName

sunny_talwar

Sorry the function is FileBaseName()

FileBaseName ‒ QlikView

LOAD AllFieldNames,

          Date(Date#(Right(FileBaseName(), 8), 'DD-MM-YY')) as Date

FROM SourceFile;