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 (Server Admin App -> Home -> FPL 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 (Server Admin App -> Home -> FPL 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.. 3

getMessageText 4

getMiliSecBTD. 5

getMiliSecs. 5

isCalledForm.. 5

isUserInGroup. 6

requestProperty. 6

runScheduleEvent 7

testURLConnection. 7

write2CSV. 8

writeToFile. 9

 

 

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 corresponding to the control that triggered the current processing when the control is inside a Table Control or a Repeater Control. Returns -1 if processing is not triggered by a control associated with a table row.

 

 

Examples:

set ROW_NUM = getActionTableRow();

 

 

Implementation:

Function name:

getactiontablerow

Description:

Returns the table row corresponding to the control that triggered 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

 

 

 

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 using the field names? (Y/N). Note a data row is also written.

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 header row containing the field names, followed by a blank row, and then one row for each row in the MyTable table.

 

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

 

Create the Header Row:

char dir, fname, fields, delim, head, new, quote, status;

dir = 'C:/Temp/';

fname = 'MyCsvFile.csv';

// this writes a header and also a blank data row as there are no such fields in the form

fields = 'FIRST_NAME, LAST_NAME, AGE ,TITLE, POSTCODE';

delim = ',' ;

head = 'Y';

new = 'Y';

quote = 'Y';

status = write2csv (dir, fname, fields, delim, head, new, quote); 

 

Write out  the data elements:

head = 'N';

new = 'N';

fields = 'MYTABLE-FIRST_NAME, MYTABLE-LAST_NAME, MYTABLE-AGE , MYTABLE-TITLE, MYTABLE-POSTCODE';

loop at table MyTable

  status = write2csv (dir, fname, fields, delim, head, new, quote);

endloop

 

 

 

Implementation:

Function name:

write2csv (This is the name of the function that will be used in FPL)

Description:

Creates a .csv file in the specified path

Implementing Java class:

com.ebasetech.ufs.customfunctions.Write2CSV

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Directory into which the file should be written

2

String

What to call the file this must include the extension (MyFile.txt)

3

String

A comma separated list of the form fields to be written to the file

4

String

The delimiter to be used, eg a comma

5

String

Should a header row be created containing the field names (Y/N)

6

String

Create a new file or append to existing file (Y/N)

7

String

Should quotes be placed around each piece of data (Y/N)

 

 

writeToFile

 

Syntax:

writetofile(DIR,FILENAME,STRING_VALUE)

 

 

Description:

Writes a string value to a text file

 

 

Examples:

set DIR = 'c:/temp/';

set FILENAME = 'MyTextFile.txt';

set STRING_VALUE = 'Mary had a little lamb..';

set STATUS = writetofile(DIR,FILENAME,STRING_VALUE);

 

 

 

Implementation:

Function name:

writetofile

Description:

Writes a string value to a text file

Implementing Java class:

com.ebasetech.ufs.customfunctions.WriteToFile

Return type:

String

Parameters:

 

 

Sequence

Field type

Description

1

String

Directory into which the text file should be written

2

String

Name to call the text file (include extension)

3

String

String to write to the file