Actuate JavaScript API classes : Class actuate.reportexplorer.File

Class actuate.reportexplorer.File

Description

actuate.reportexplorer.File is a reference object for displaying and controlling a file reference.

Constructor

Syntax

actuate.reportexplorer.File( )

Constructs a new File object.

Function summary

Table 4-35 lists actuate.reportexplorer.File functions.

actuate.reportexplorer.File.getAccessType

Syntax

string File.getAccessType( )

Gets the access type.

Returns

String. Either "private" or "shared" according to whether the file has been shared or not.

Example

To stop a script from running if a File is private, use code similar to the following:

if(file.getAccessType( ) == "private"){ return;}

actuate.reportexplorer.File.getDescription

Syntax

string File.getDescription( )

Gets the description from the file.

Returns

String. The Description.

Example

To stop a script from running if a file does not have a description, use code similar to the following:

if(file.getDescription( ) == (null || "")){ return;}

actuate.reportexplorer.File.getFileType

Syntax

string File.getFileType( )

Gets the file extension value for this File.

Returns

String. The file type.

Example

To store the file extension of the File object file in a variable called type, use code similar to the following:

var type = file.getFileType( );

actuate.reportexplorer.File.getId

Syntax

integer File.getId( )

Gets the file Id value.

Returns

Integer.

Example

To store the file id of the File object file in a variable called id, use code similar to the following:

var id = file.getFileId( );

actuate.reportexplorer.File.getName

Syntax

string File.getName( )

Gets the name of the file.

Returns

String.

Example

To store the name of the File object file in a variable called name, use code similar to the following:

var name = file.getName( );

actuate.reportexplorer.File.getOwner

Syntax

string File.getOwner( )

Gets the name of the owner.

Returns

String.

Example

To store the name of the owner of the File object file in a variable called owner, use code similar to the following:

var owner = file.getOwner( );

actuate.reportexplorer.File.getPageCount

Syntax

integer File.getPageCount( )

Gets the number pages in the file, if applicable.

Returns

Integer.

Example

To halt a script if the number of pages exceeds 100 in the file referenced by the File object largefile, use code similar to the following:

if (largefile.getPageCount( ) > 100) {return;}

actuate.reportexplorer.File.getSize

Syntax

integer File.getSize( )

Gets the size value for this file.

Returns

Integer.

Example

To store a file object size in a variable called size, use code similar to the following:

var size = file.getSize( );

actuate.reportexplorer.File.getTimeStamp

Syntax

string File.getTimeStamp( )

Gets the time stamp.

Returns

String.

Example

To store the time stamp for the file referenced by the File object oldfile in a variable called timestamp, use code similar to the following:

var timestamp = oldfile.getTimeStamp( );

actuate.reportexplorer.File.getUserPermissions

Syntax

string File.getUserPermissions( )

Gets the user permissions.

Returns

String.

Example

To store a file’s permissions in the permissions variable, use code similar to the following:

var permissions = file.getUserPermissions( );

actuate.reportexplorer.File.getVersion

Syntax

integer File.getVersion( )

Gets the version of the file.

Returns

Integer.

Example

To store the file version in the version variable, use code similar to the following:

var version = file.getVersion( );

actuate.reportexplorer.File.getVersionName

Syntax

string File.getVersionName( )

Gets the version name.

Returns

String.

Example

To store a version name in the version variable, use code similar to the following:

var version = file.getVersionName( );

actuate.reportexplorer.File.setAccessType

Syntax

void File.setAccessType(string accessType)

Sets the access type.

Parameters

accessType

String. "private" or "shared" indicating whether the file has been shared or not.

Example

To make a file private, use code similar to the following:

file.setAccessType("private")

actuate.reportexplorer.File.setDescription

Syntax

void File.setDescription(string description)

Sets the description from the file.

Parameters

description

String. The Description.

Example

To clear a file’s description, use code similar to the following:

file.setDescription("");

actuate.reportexplorer.File.setFileType

Syntax

void File.setFileType(string fileType)

Sets the file Type value for this File.

Parameters

fileType

String. The file type.

Example

To assign a file’s type if none is assigned, use code similar to the following:

if (file.getFileType == null) {file.setFileType("text");}

actuate.reportexplorer.File.setId

Syntax

void File.setId(integer id)

Sets the file Id value.

Parameters

id

Integer.

Example

To set a file’s id to 42, use code similar to the following:

file.setId("42");

actuate.reportexplorer.File.setName

Syntax

void File.setName(string name)

Sets the name of the file.

Parameters

name

String.

Example

To set a file’s name to releasedates, use code similar to the following:

file.setName("releasedates");

actuate.reportexplorer.File.setOwner

Syntax

void File.setOwner(string owner)

Sets the name of the owner.

Parameters

owner

String.

Example

To set a file’s owner to Administrator, use code similar to the following:

file.setOwner("Administrator");

actuate.reportexplorer.File.setPageCount

Syntax

void File.setPageCount(integer pageCount)

Sets the number pages in the file, if applicable.

Parameters

pageCount

Integer.

Example

To set a file object’s page to 100 if available, use code similar to the following:

if(file.getPageCount( ) > 100) {file.setPageCount(100)};

actuate.reportexplorer.File.setSize

Syntax

void File.setSize(integer size)

Sets the size of the file.

Parameters

size

Integer.

Example

To reset a file’s size to zero, use code similar to the following:

file.setSize(0);

actuate.reportexplorer.File.setTimeStamp

Syntax

void File.setTimeStamp(string timeStamp)

Sets the time stamp.

Parameters

timeStamp

String.

Example

To set a file’s timestamp to the current time, use code similar to the following:

var currenttime = new Date( );
file.setTimeStamp(currenttime.toLocaleString( ));

actuate.reportexplorer.File.setUserPermissions

Syntax

void File.setUserPermissions(string userPermissions)

Sets the user permissions.

Parameters

userPermissions

String.

Example

To apply the user permissions for file1 to file2, use code similar to the following:

file2.setUserPermissions(file1.getUserPermissions( ));

actuate.reportexplorer.File.setVersion

Syntax

void File.setVersion(integer version)

Sets the version of the file.

Parameters

version

Integer.

Example

To set the file’s version to 1 for the first version, use code similar to the following:

file.setVersion(1);

actuate.reportexplorer.File.setVersionName

Syntax

void File.setVersionName(string versionName)

Sets the version name.

Parameters

versionName

String.

Example

To reset a file’s version name to 2004, use code similar to the following:

file.setVersionName("2004");

(c) Copyright Actuate Corporation 2011