Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

time and date of created file (much like filetime)

Hi,

I'm looking for a function which is much like filetime.

Filetime will give me the modification time and date.

filetime.PNG.png

Only difference is that I would like to get the time and date of creation.

That will tell when exactly when the file was copied into a Folder (and is accessible for Qlikview)

Can anyone tell me what function I need to use?

2 Replies
florentina_doga
Contributor III

Re: time and date of created file (much like filetime)

Attribute(filename, attributename)

Returns the value of the meta tags of different file formats, e.g. MP3, WMA, WMV and JPG files, as text.

Filename is the name of a media file including path, if needed.

Attributename is the name of a meta tag.

If the file filename does not exist, is not a supported file format or does not contain a meta tag named attributename, null will be returned.

A large number of meta tags can be used, e.g. ‘Artist’ or ‘Date Picture Taken’. The supported tags can automatically be generated in the script. The keyboard shortcut for this generation is Ctrl + Q,J,P,G for jpg files (keep the Ctrl key pressed while typing the QJPG combination), Ctrl + Q,M,P,3 for mp3 files and Ctrl + Q,W,M,A for wma files.

Example:

Attribute('File', 'Title') as X,

returns the mp3 tag 'title' in field X in each record.

ConnectString()

Returns the active connect string for ODBC or OLE DB connection. Returns an empty string if no connect statement has been executed or after a disconnect statement.

filebasename()

Returns a string containing the name of the table file currently being read, without path or extension.

Example:

Load *, filebasename( ) as X from

C:\UserFiles\abc.txt

Will return 'abc' in field X in each record read.

filedir()

Returns a string containing the path to the directory of the table file currently being read.

Example:

Load *, filedir( ) as X from

C:\UserFiles\abc.txt

Will return 'C:\UserFiles' in field X in each record read.

fileextension()

Returns a string containing the extension of the table file currently being read.

Example:

Load *, fileextension( ) as X from

C:\UserFiles\abc.txt

Will return 'txt' in field X in each record read.

filename()

Returns a string containing the name of the table file currently being read, without path but including the extension.

Example:

Load *, filename( ) as X from

C:\UserFiles\abc.txt

Will return 'abc.txt' in field X in each record read.

filepath()

Returns a string containing the full path to the table file currently being read.

Example:

Load *, filepath( ) as X from

C:\UserFiles\abc.txt

Will return 'C:\UserFiles\abc.txt' in field X in each record read.

filesize()

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.

Examples:

filesize( 'xyz.xls' )

Will return the size of the file xyz.xls.

Load *, filesize( ) as X from abc.txt ;

Will return the size of the specified file (abc.txt) as an integer in field X in each record read.

filetime([ filename ])

Returns a timestamp for the date and time of the last modification of the file filename. If no filename is specified, the function will refer to the currently read table file.

Examples:

filetime( 'xyz.xls' )

Will return the timestamp of the last modification of the file xyz.xls.

Load *, filetime() as X from abc.txt ;

Will return the date and time of the last modification of the file (abc.txt) as a timestamp in field X in each record read.

GetFolderPath()

Returns the value of the Microsoft Windows SHGetFolderPath function and returns the path for e.g. My Music. Note that the function does not use the spaces seen in Windows Explorer.

Examples:

GetFolderPath('MyMusic')

GetFolderPath('MyPictures')

GetFolderPath('MyVideos')

GetFolderPath('MyReceivedFiles')

GetFolderPath('MyShapes')

GetFolderPath('ProgramFiles')

GetFolderPath('Windows')

QvdCreateTime(filename)

Returns the XML-header time stamp from a QVD file if any (otherwise NULL).

The filename is the name of a QVD file, if necessary including path.

Examples:

QvdCreateTime('MyFile.qvd')

QvdCreateTime('C:\MyDir\MyFile.qvd')

QvdNoOfRecords(filename)

Returns the number of records currently in a QVD file.

The filename is the name of a QVD file, if necessary including path.

Examples:

QvdNoOfRecords ('MyFile.qvd')

QvdNoOfRecords ('C:\MyDir\MyFile.qvd')

QvdNoOfFields(filename)

Returns the number of fields in a QVD file.

The filename is the name of a QVD file, if necessary including path.

Examples:

QvdNoOfFields ('MyFile.qvd')

QvdNoOfFields ('C:\MyDir\MyFile.qvd')

QvdFieldName(filename , fieldno)

Returns the name of field number fieldno, if it exists in a QVD file (otherwise NULL).

The filename is the name of a QVD file, if necessary including path.

The fieldno is the number of the field (0 based) within the table contained in the QVD file.

Examples:

QvdFieldName ('MyFile.qvd', 3)

QvdFieldName ('C:\MyDir\MyFile.qvd', 5)

  QvdTableName(filename)

MVP
MVP

Re: time and date of created file (much like filetime)

May be you can try with macro, like:

Function ShowFileInfo(filespec)

   Dim fso, f

   Set fso = CreateObject("Scripting.FileSystemObject")

   Set f = fso.GetFile(filespec)

   ShowFileInfo = "Created: " & f.DateCreated

End Function

Community Browser