www.buildautomator.com  Build Automator Documentation

Function Reference

Previous  Top  Next  


This is a reference guide to the functions that are available to use in the Evaluate Expression operation in the Set Variable action. 

 

This includes most of the standard runtime library functions that are not related to files and data.  Below is a list of functions that you can use in the expression in the Set Variable action.  Below is simple documentation for the available functions.  We may also add some functions of our own that are not part of the Clarion Runtime Library but could be useful in the Build Automator.  Parameters in square brackets (i.e. inside [] ) indicate optional parameters.  We may add more detailed help for functions that need it.

 

Note that you MUST enclose strings being passed to those functions with double quotes (")

Functions marked with ** are functions that are only available in Build Automator and are not Clarion RTL functions.

 

Function

Description

Abs (expression)

Returns the absolute value of expression.

Acos (expression)

Returns the arccosine value of the expression.

Age (birthday [, basedate])

Returns a string containing age calculation for the birthday.  If the basedate is omitted, the system date is used.  The returned string is in the following format:
1-60 days: "nn DAYS"

61 days - 24 months: "nn MOS"

2 years - 999 years: "nnn YRS"

See also: Date, Day, Month, Year function.

All (string [,length])

Returns a string that is length characters long, repeatedly filled with string

Example: 

All("-",80)

 

would fill the variable with 80 dashes (-)

And

Logical AND

Asin (expression)

Returns the Arcsine of the value of the expression.

Atan (expression)

Returns the Arctangent of the value of the expression.

Band (value, mask)

Returns the results of bitwise AND of each bit.

Bor (value, mask)

Returns the results of bitwise OR of each bit.

Bshift (value, count)

Returns the value of value after shifting the bits count left or right.  Positive count shifts the bits to the left, negative count shifts the bits to the right.

Bxor (value, mask)

Returns the results of bitwise exclusive OR operation on value.

Center (string ,length)

Returns string that is centered based on the length parameter.  For example:

Center("123",7) would return "  123  " - i.e. 123 with two spaces on each side.

Choose (expression, value, value[,value...])

Returns a value based on the expression. 

Example:

Choose(%X%,2,4,6)  

 

If %X% is 1, then it would return 2

If %X% is 2, then it would return 4

If %X% is 3, then it would return 6

Choose (condition[, value, value])

Returns true or false (1 or 0) depending on the condition. 

Example:

Choose(%X% = 1,'True','False')

This would return 'True' if the value of %X% was 1, otherwise it would return 'False'

Chr (charactercode)

Returns the character for the ASCII charactercode

Example:

Chr(32) would return a space

Chr(65) would return 'A' (uppercase a)

Clip (string)

Returns the string with no trailing spaces.

Clock ()

Returns the system clock value.  Note that this is in centiseconds, 1/100 of a second, not milliseconds.  To get ms, use:

 

Clock() * 10

**CompareVersionStrings
(ver1, ver2, level)

Compares version strings in ver1 and ver2.  The level specifies the level to compare, 1 compares only the first number, 2 compares first and second number, etc.  The level must range from 1 to 4.  This function can only compare strings that are formatted as aaa.bbb.ccc.ddd.  Each level is individually cast to an integer and compared, for example 1.20 is greater than 1.2. 

The function returns one of 3 possible values:

0 = ver1 and ver2 are equal to the level specified

1 = ver1 is greater than ver2

2 = ver2 is greater than ver1

Example:

CompareVersionStrings("%VERSION1%","%VERSION2%",3)

 

This will compare the first 3 levels of the %VERSION1% and %VERSION2% string variables.  For example if %VERSION1% is "1.2.3.4" and %VERSION2% is "1.2.3.5" the result would be 0 as the first 3 levels ("1.2.3") are equal.  If the level was set to 4, the results would be 2 because %VERSION2% is greater than %VERSION1%

Demo:

Compare Version Strings.aprj demo project.

Cos (radians)

Returns the cosine of the radians value.

Date (month, day, year)

Return a standard Clarion date based on the value for month, day and year.  A Clarion date is set to 0 on December 29, 1800. 

Example:

Date(Month()+1,1,Year())

 

This would return the first day of next month.  Note that you can use out of bounds values, such as 13 for months, or 40 for days to advance the date calculation by specific period. 

Day (date)

Returns the day of month for the date value. 

Example:

Day(Today())

 

would return 15 on June 15, 2014.

Deformat (string, format)

Returns the string with formatting removed based on the format parameter.  The format can be any of the format tokens used in standard Clarion data formatting

**ExpandEnv(string)

Expands the environment variable passed in string and returns the expanded variable contents.

Example:

ExpandEnv("PATH")

 

will return the contents of the %PATH% environment variable.  Note that starting in version 2.0 you have access to all available environment variables directly in your actions. 

**FileExists(string)

Returns 1 (true) or 0 (false) depending on if the file or folder specified in string exists.

Example:

FileExists("%MYFOLDER%")

Format (string, format)

Returns the string formatted based on the format parameter.  The format can be any of the format tokens used in standard Clarion data formatting

**GetFileDate(filename)

Returns the Clarion Date value of the file.  Filename must be enclosed in double quotes.  Use Format() to format the date value.  See Date formats.

**GetFileSize(filename)

Returns the size of the file as an unformatted 32bit signed integer.  Filename must be enclosed in double quotes.  Use format to format the value.  See Number formats.

**GetFileTime(filename)

Returns the Clarion Time value of the file.  Filename must be enclosed in double quotes.  Use Format() to format the time value.  See Time formats.

Getini (section, entry [,default] [,file])

Retrieves a value from an INI file. 

Example:
GetIni("Source","Root","C:\","C:\test.ini")

 

If the test.ini file contained:

[Source]

Root=F:\files

 

Then the GetIni would return "F:\files"

If the file is not specified it defaults to win.ini.  If path is not specified in the file parameter, it defaults to the windows folder.  Note that GetReg is not available, but you can always use the Get From INI and Get From Registry actions.

Inlist (searchstring, liststring, liststring[,liststring...])

Inlist compares the value of searchstring to the liststring values and returns the index number of the first liststring that matches the searchstring.  If no match is found it returns zero.

Inrange (expression, low, high)

Compares a numeric expression to the range of low and high value and returns True (1) if the expression is within the low to high range.  If the expression is lower than the low parameter or higher than the high parameter, the function returns False (0)

Instring (searchstring, string, step,start)

The Instring function searches for the searchstring in the string starting at the start position.  The step is used to specify the step length of the search.  Normally the step is set to 1.  Step can be negative and then it searches backward, but then searchstring is limited to a single character.  The function returns the position of the first occurance of the searchstring in the string or zero (0) if the searchstring was not found. 

Example:

Instring("X","THIS IS X",1,1)

 

would return 9. 

Int (expression)

Returns the integer portion of expression.  No rounding is performed. 

Example:
Int(12.44)

returns 12

Int(-6.3) 

returns -6

Left (string [,length])

Left justifies the string.  All leading spaces are removed.  The length is used to determine the length of the resulting string:

Example:
Left("  ABC")

returns "ABC  "

Len (string)

Returns the length of the string.

Log10 (expression)

Returns base 10 logarithm for the expression.  If the expression is 0 or less, the returned value is 0.

Loge (expression)

Returns the natural logarithm for the expression.  The value of e is determined to be 2.71828182846

Longpath (shortfilename)

Returns the long path or filename for the shortfilename

Lower (string)

Returns the string converted to lower case.

Match (first, second, mode)

Returns true or false (1 or 0) based on comparison between the first and the second parameters.

Month (date)

Returns the month number (1..12) for the date.  The date must be a standard Clarion date with base date on December 29, 1800.  See Date.

Not

Logical NOT

Numeric (string)

Returns true (1) if the string only contains a valid numeric value.  Valid numeric characters are 0123456789-.

Or

Logical OR

Path ()

Returns the current path.

Random (low, high)

Returns a random integer between low and high, both included.

Right (string [,length])

Returns a right justified string.  The length is used to determine the length of the resulting string. 

Example:

Right("ABC  ")

returns "  ABC"

Round (expression, order)

Rounds the value of expression rounded to the power of 10. 

Example:

Round(1234,100) 

returns 1200

Round(675.6,1) 

returns 676

Round(25.12595,0.01) 

returns 25.13

**SearchReplace(search, replace, text)

Searches for "search" in "text" and replaces it with "replace" and returns the results.

Example:

SearchReplace(".","_","This.is.a.string.with.periods.in.it")

returns:
"This_is_a_string_with_periods_in_it"

Shortpath (longfilename)

Returns the shortened path for the longfilename.

Sin (radians)

Returns the sine of an angle measured in radians.

Sqrt (expression)

Returns the square root of expression.

Strpos (first, second[, mode])

Returns the starting position where the first and second strings match.

Sub (string, position, length)

Returns a length long substring from string starting at position.

Tan (radians)

Returns the tangent of an angle measured in radians.

Today ()

Returns the standard Clarion date value for today.

Upper (string)

Converts the string to upper case.

Val (character)

Returns the ASCII value of the character.

Xor

Boolean exclusive OR

Year (date)

Returns the year of a standard Clarion date.

 



Direct link to this page: http://www.buildautomator.com/onlinemanual/function_reference.htm