Please enable JavaScript to view this site.

Altova MobileTogether Designer

The Get File Info action (screenshot below) adds information about the specified file (or folder) to a page source called $MT_FILEINFO. Note that there is only one $MT_FILEINFO page source per page. So, if multiple Get File Info actions are triggered during the processing of a page at run time, then $MT_FILEINFO at any given time will contain information from the last Get File Info action that was triggered.

MTActionGetFileInfo

Note:The $MT_FILEINFOT page source is also created in the design

 

Structure of the $MT_FILEINFO tree

The structure the $MT_FILEINFO tree is as shown in the screenshot below. The Root element has a number of attributes that will be filled with the file information of the file specified in the triggered action. Descriptions of the attributes are given below.

MTActionGetFileInfoTree

Path: The full path of the file being reported.

Size: The file size In bytes.

CreationTime: The time when the file was created at its current location. If a file is copied to a new location, then the time at which it was copied will be the creation time. In such cases, the creation time could be later than the WriteTime.

AccessTime: The time when the file was last accessed.

WriteTime: The time when the file was last written to.

IsDirectory: Can take a value of true or false.

IsReadOnly: Can take a value of true or false.

 

Note:The data read by the Get File Info action is passed to the attributes of $MT_FILEINFO/Root (as described above). The $MT_FILEINFO/Root node, however, also has child elements: repeating File elements, which receive data via another action, Read Folder. The Read Folder action fills the File elements with metadata about files in a specified folder.

 

Example

An example file named ReadFolderGetFileInfo.mtd shows how to use the Get Info action (see screenshot of simulation below). This file is available in the (My) Documents folder Altova\MobileTogetherDesigner6\MobileTogetherDesignerExamples\Tutorials\Actions.

Click to expand/collapse

The example works as follows:

 

The end user enters the name of a file in the edit field to the left of the Get File Info button.

The file name is written to the Root/File node of the $PERSISTENT tree (see screenshot).

The Get File Info button has a Get File Info action set for its OnButtonClick event that targets the file (or folder) stored in $PERSISTENT/Root/File.

On clicking Get File Info, the information of the targeted file is read and passed to the $MT_FILEINFO page source as the values of the attributes of $MT_FILEINFO/Root.

These attribute values are displayed in the cells of a static table.

 

© 2019 Altova GmbH