Additional Supplied Functions

Documentation home 

 

This document contains details of additional functions that have been developed to meet the needs of individual customers. The Java code for these functions is shipped with the standard Ebase product, but the functions have not been added to the functions table (Tools -> Maintain Functions). They can be added as required. For each function, the implementation section describes the parameters required to add the function to the system using (Tools -> Maintain Functions) and these can be cut and pasted into the functions dialog. The functions are then immediately available for use.

 

These functions are supported by Ebase on a best efforts basis.

 

addresslookupqa. 1

addressidlookupqa. 2

deleteFile. 2

getActionField. 3

getActionTableRow.. 3

getCallingForm.. 4

getMessageText 4

getMiliSecBTD. 5

getMiliSecs. 5

javaMethod. 6

isCalledForm.. 6

isUserInGroup. 6

requestProperty. 7

runScheduleEvent 7

testURLConnection. 8

write2CSV. 8

writeToFile. 10

 

 

addresslookupqa

 

Please note that the Quick Address system must be installed and the proweb.jar file available on the Ebase classpath to use this function.

 

Syntax:

addresslookupqa (string1, string2)

 

 

Description:

This function is used to perform UK postcode lookups with the Quick Address software.

Returns the number of addresses at postcode in string1. string2 must be a literal containing the name of a form field of display type selection.

Populates string2 with list of addresses found, if any.

 

 

Examples:

set ADDRESS_COUNT = addresslookupqa(POSTCODE, 'ADDRESSES');

 

 

Implementation:

please contact Ebase support support@ebasetech.com for implementation details.

 

 

addressidlookupqa

 

Please note that the Quick Address system must be installed and the proweb.jar file available on the Ebase classpath to use this function.

 

Syntax:

addressidlookupqa (string1, string2, string3, string4, string5, string6, string7, string8)

 

 

Description:

This function is used to perform UK postcode lookups with the Quick Address software.

Returns the number of addresses (always 1) for address id string1.string2 , string3, string4, string5, string6, string7, string8 must be a literals containing names of form fields of display type text.Populates form fields represented by string2 , string3, string4, string5, string6, string7, string8 with address line 0, address line 1, address line 2, address line 3, town, county and postcode respectively for address id string1.

 

 

Examples:

set DUMMY = addressidlookupqa(ADDRESS_ID, 'LINE_0', 'LINE_1', 'LINE_2', 'LINE_3', 'TOWN', 'COUNTY', 'POSTCODE');

 

 

Implementation:

please contact Ebase support support@ebasetech.com for implementation details.

 

 

deleteFile

 

Syntax:

deletefile(fullpath_filename_ext)

 

 

Description:

Deletes a file from a given folder

 

 

Examples:

set FULLPATH_FILENAME_EXT = 'c:/temp/MyTest.txt';

set STATUS = deletefile(FULLPATH_FILENAME_EXT);

 

 

Implementation:

Function name:

deletefile

Description:

Deletes a file from a given folder

Implementing Java class:

com.ebasetech.ufs.customfunctions.DeleteFile

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Path + filename + file extension of file to be deleted

 

 

getActionField 

 

Syntax:

getActionField()

 

 

Description:

Returns the name of the field that triggered the current processing. This is only applicable for immediate validation fields, buttons and hyperlinks. Note that in the particular case when the current processing was triggered by an event associated with a table column e.g. hyperlink, button etc, and a fetchtable FPL command is issued against the table as part of this processing,  this function will return null.

 

 

Examples:

set ACTION_FIELD = getActionField();

 

 

Implementation:

Function name:

getactionfield

Description:

Returns the name of the immediate validation field driving the current processing

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetActionField

Return type:

String

Parameters:

None

 

 

getActionTableRow 

 

Syntax:

getActionTableRow()

 

 

Description:

Returns the row number of the field that triggered the current processing when the field is a table cell. This is only applicable for immediate validation fields, buttons and hyperlinks. Returns 0 if processing is not triggered by a table cell action event.

 

 

Examples:

set ROW_NUM = getActionTableRow();

 

 

Implementation:

Function name:

getactiontablerow

Description:

Returns the table row containing the immediate validation field driving the current processing

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetActionTableRow

Return type:

int

Parameters:

None

 

getCallingForm 

 

Syntax:

getCallingForm()

 

 

Description:

Returns the name of the form that called the current form.

 

 

Examples:

set CALLING_FORM = getCallingForm();

 

 

Implementation:

Function name:

getcallingform

Description:

Returns the name of the calling form

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetCallingForm

Return type:

String

Parameters:

None

 

getMessageText 

 

Syntax:

getMessageText(project, message_number [, parm1, parm2,…] )

 

project is the name of the project containing the message

message_number is the number of the message

parm1, parm2 etc are variables to be substituted into the message text replacing && strings

 

 

Description:

Returns a message text with any variables substituted.

In a multi-lingual system, the same rules are applied to select the language as are used to display a text using the FPL message command.

 

 

Examples:

set TEXT1 = getMessageText($PROJECT, 1007);

set TEXT2 = getMessageText('GLOBAL', 10000, POSTCODE, CITY);

 

 

Implementation:

Function name:

getmessagetext

Description:

Returns a message text with any variables substituted

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetMessageText

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Project id

2

int

Message number

3

String

Variable 1 to be substituted into the message text (optional)

4

String

Variable 2 to be substituted into the message text (optional)

5

String

Variable 3 to be substituted into the message text (optional)

6

String

Variable 4 to be substituted into the message text (optional)

7

String

Variable 5 to be substituted into the message text (optional)

 

getMiliSecBTD

 

Syntax:

getmilisecBTD(DATE1,DATE2)

 

 

Description:

Returns the milliseconds between two dates

Where DATE1 and DATE2 are fields of type date

 

 

Examples:

set DATE1 = '01/09/2006';

set DATE2 = '05/09/2006';

set STATUS = getmilisecBTD(DATE1,DATE2);

 

 

Implementation:

Function name:

getmilisecBTD

Description:

Returns the milliseconds between two dates

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetMiliSecBTD

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

double

Date1 – This is the from date

2

double

Date2 – This is the to date

 

 

getMiliSecs

 

Syntax:

getmilisecs()

 

 

Description:

Returns the milliseconds of the current time

 

 

Examples:

set MILISECS = getmilisecs();

 

 

Implementation:

Function name:

getmilisecs

Description:

Returns the milliseconds of the current time

Implementing Java class:

com.ebasetech.ufs.customfunctions.GetMiliSecs

Return type:

String

Parameters:

None

 

 

javaMethod 

 

Syntax:

javaMethod(methodName, methodArg1, methodArg2 ...)

 

 

Description:

Call a static method in any java class in the classpath.  The first argument is the name of the method including the full class name.  This is followed by any number of arguments.  The argument and return types must all be of type java.lang.String or java.lang.Double.

 

 

Examples:

Set TIMEZONE = javaMethod('java.lang.System.getProperty', 'user.timezone');

 

 

Implementation:

Function name:

javaMethod

Description:

Call a static method in any java class in the classpath

Implementing Java class:

com.ebasetech.ufs.customfunctions.JavaMethod

Return type:

String or Double

Parameters:

Any number of String or Double.

 

 

 

isCalledForm 

 

Syntax:

isCalledForm()

 

 

Description:

Returns Y or N to indicate that the current form has been called using CALL FORM.

 

 

Examples:

if [ isCalledForm() = 'Y' ]

 

 

Implementation:

Function name:

iscalledform

Description:

Returns Y or N to indicate that this form has been called by another form

Implementing Java class:

com.ebasetech.ufs.customfunctions.IsCalledForm

Return type:

String

Parameters:

None

 

 

isUserInGroup

 

Syntax:

isUserInGroup(userid, groupid)

 

 

Description:

Returns true or false to indicate whether a user is in a security group.

 

 

Examples:

if [ isUserInGroup( $USER, GROUPNAME ) ) …

 

 

Implementation:

Function name:

isuseringroup

Description:

Returns true or false to indicate whether a user is in a security group

Implementing Java class:

com.ebasetech.ufs.customfunctions.IsUserInGroup

Return type:

boolean

Parameters:

 

 

Sequence

Field type

Description

1

String

User id

2

String

Group id

 

requestProperty

 

Syntax:

requestProperty(property)

 

 

Description:

Returns information about the HTTP request

 

 

Examples:

set IPADDRESS = requestProperty(‘remoteAddr’);

 

 

Implementation:

Function name:

requestProperty

Description:

Returns information about the HTTP request

Implementing Java class:

com.ebasetech.ufs.customfunctions.RequestProperty

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Property name.  The available properties are all of the get methods in javax.servlet.http.HttpServletRequest that take no arguments.  e.g. serverName, serverPort, remoteHost, remoteAddr, requestURL, servletPath

 

runScheduleEvent

 

Syntax:

runScheduledEvent(fullpath_filename_ext)

 

 

Description:

Executes a scheduler event via a trigger

 

 

Examples:

set RESP = runscheduleevent (FULLPATH_FILENAME_EXT);

 

 

Implementation:

Function name:

runscheduleevent

Description:

Executes a scheduler event via a trigger

Implementing Java class:

com.ebasetech.ufs.customfunctions.RunScheduleEvent

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Trigger id (required)

2

String

Userid

3

String

Password

4

String

Execution mode, options are ‘Synch’ or ‘Asynch’

5

String

Verbose mode, options are ‘true’ or ‘false’

 

 

testURLConnection

 

Syntax:

testURLConnection(url)

 

 

Description:

Tests whether a Http URL connection is available. Returns ‘Y’ if the connection is available or ‘N’ if the connection is unavailable. This function performs a HTTP GET to the calling URL. If a response is not received within 20 seconds then the function will return ‘N’.

 

 

Examples:

set AVAILABLE = testurlconnection( ‘http://www.google.co.uk’ );

 

 

Implementation:

Function name:

testurlconnection

Description:

Tests whether a HTTP URL connection is available

Implementing Java class:

com.ebasetech.ufs.customfunctions.TestURLIsAvailable

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

URL Connection String

 

write2CSV

 

Syntax:

write2csv(DIR, FNAME, FIELDS, DELIM, HEAD, NEW, QUOTE)

 

DIR - the directory to which the file should be written

FNAME - the name that should be given to the file

FIELDS - a comma separated list of form fields whose data should be written to the file

DELIM - the character that should be used to separate the data in the file

HEAD - should a header row be created with the file names? (Y/N)

NEW - should a new file be created? (Y/N)

QUOTE - should double quotes be placed around each data element in the file?

 

 

Description:

Writes data to a delimited text file using parameters passed from a form

 

 

Examples:

In this example we will create a new CSV file and write a single row which will contain the
names of the fields who’s data is going to be written to the file.

 

Then we will loop through a table and write out column values to the same file.

 

Create the Header Row:

 

set DIR = 'C:/Temp/';

set FNAME = 'MyCsvFile.csv';

set FIELDS = ('FIRST_NAME,LAST_NAME,AGE,TITLE, POSTCODE');

set DELIM = ',' ;

set HEAD = 'Y';

set NEW = 'Y';

set QUOTE = 'Y';

set STATUS = write2csv (DIR,FILENAME,FIELDS,DELIM,HEAD,NEW,QUOTE);