Skip to main content

Ens.Util.FunctionSet

abstract class Ens.Util.FunctionSet

This class contains a set of utility methods that can be used by Business Rules, DTL transforms and the like.

Method Inventory

Methods

final classmethod Contains(value As %String, substring As %String) as %Boolean
Tests if the given value contains the given substring.
final classmethod ConvertDateTime(value As %String = "", informat As %String = "%Q", outformat As %String = "%Q", outf As %String = "") as %String
Takes string value representing a date/time value in format informat and converts it to a date/time string in format outformat. Any %f elements in outformat will be replaced with the outf string. If the input string does not match informat, it will be output unchanged. The default for both input and output formats is ODBC format (%Q) in the server's local timezone.
classmethod CurrentDateTime(format As %String = "%Q") as %String
Returns a string representing a date/time value in format format. The default format is ODBC format (%Q) in the server's local timezone.
final classmethod DoesNotContain(value As %String, substring As %String) as %Boolean
Tests if the given value contains the given substring.
final classmethod DoesNotIntersectList(value As %String, items As %String, SourceListSeparator As %String = "><", TargetListSeparator As %String = "><") as %Boolean [ SQLProc = DoesNotIntersectList ]
Projected as the stored procedure: DoesNotIntersectList
Tests if the given source list, value, does not contain any item that is contained in the target list, items. See IntersectsList() for description.
final classmethod DoesNotMatch(value As %String, pattern As %String) as %Boolean [ SQLProc = DoesNotMatch ]
Projected as the stored procedure: DoesNotMatch
Tests if the given value matches the pattern given in the ? operator pattern syntax.
final classmethod DoesNotStartWith(value As %String, start As %String) as %Boolean
Tests if the given value does not start with the string in start.
final classmethod Exists(table As %String = "", value As %String = "") as %Boolean
Test if the key specified by value is defined within the lookup table specified by table.
Return true (1) if it is defined, and false (0) otherwise.
final classmethod If(value As %String = "", true As %String = "", false As %String = "") as %String
If value is true, returns the value of true otherwise returns the value of false.
final classmethod In(value As %String, items As %String) as %Boolean
Tests if the given value is among the items in a comma-delimited string.
final classmethod InFile(value As %String, filenameSpec As %String) as %Boolean [ SQLProc = InFile ]
Projected as the stored procedure: InFile
Tests if the given value is in the specified column in a table-formatted text file.
The filenameSpec argument consists of the filename followed by a comma and then a comma-separated list of additional parameters:
  1. columnPos (default = 1) - means character pos if positional, column ordinal if delimited.
  2. rowSeparator (default = linefeed); negative value means row length if positional.
  3. columnSeparator (default = tab) - zero value means positional columns.
  4. columnWidth (default =0 meaning delimited not fixed-width) - means char count if positional.
  5. lineComment (default = none)
  6. stripPadChars (default = space,tab)
final classmethod InFileColumn(value As %String = "", filename As %String = "", columnId As %Integer = 1, rowSeparator As %String = $C(10), columnSeparator As %String = $C(9), columnWidth As %Integer = 0, lineComment As %String = "", stripPadChars=" "_$C(9)) as %Boolean
Tests if the given value is in the column specified by columnId in a table-formatted text file specified by filename.
rowSeparator indicates what character sequence separates the rows in the file, but if the value is negative, the value indicates the character length of each row.
columnSeparator indicates the character sequence used to separate columns. If the value of this argument is 0, then the value in the file is determined by extracting columnWidth characters starting at the character position columnId.
final classmethod IntersectsList(value As %String, items As %String, SourceListSeparator As %String = "><", TargetListSeparator As %String = "><") as %Boolean [ SQLProc = IntersectsList ]
Projected as the stored procedure: IntersectsList
Tests if any item from the given source list in value appears in the target list items.
A separator can be specified for the format of each list. By default the items in each list are assumed to be enclosed in angle brackets, e.g. "<Item1><Item2><Item3>".
Note: if the target list has only a single item this function is essentially the same as the Contains function. If the source list has only a single item this function is essentially the same as the In function.
final classmethod Length(value As %String = "", delimiter As %String = "") as %String
Get the length of a string. If delimiter is specified, return the number of substrings in value based on the supplied delimiter.
final classmethod Like(value As %String, pattern As %String) as %Boolean
Tests if the given value satisfies a SQL Like comparison with the given pattern string. In SQL Like patterns, % matches 0 or more characters, and _ matches any single character. Note that an escape character can be specified by appending "%%" to the pattern, e.g. "#%SYSVAR_#_%%%#" to match any value string that starts with "%SYSVAR" followed by any single character, an underscore, and anything else.
final classmethod Lookup(table As %String = "", value As %String = "", default As %String = "", defaultOnEmptyInput As %Integer = 0) as %String
Look up the key specified by value in the lookup table specified by table and return the lookup value associated with the input key value. If the input key value is not found in the specified table, return default. If the table or the value argument is empty, the flag defaultOnEmptyInput determines whether to return default or an empty string. If defaultOnEmptyInput is:
  1. 0 - Return empty string if table or value is empty.
  2. 1 - Return default if table is empty and value is not. Return empty string if value is empty.
  3. 2 - Return default if value is empty and table is not. Return empty string if table is empty.
  4. 3 - Return default if either table or value is empty.
final classmethod Matches(value As %String, pattern As %String) as %Boolean [ SQLProc = Matches ]
Projected as the stored procedure: Matches
Tests if the given value matches the pattern given in the ? operator pattern syntax
final classmethod Max(value As %String = "", v2 As %String = "", v3 As %String = "", v4 As %String = "", v5 As %String = "", v6 As %String = "", v7 As %String = "", v8 As %String = "") as %String
Returns the largest of the given values.
final classmethod Min(value As %String = "", v2 As %String = "", v3 As %String = "", v4 As %String = "", v5 As %String = "", v6 As %String = "", v7 As %String = "", v8 As %String = "") as %String
Returns the smallest of the given values.
final classmethod Not(value As %String = "") as %String
Perform a logical inversion. If value is true, return false, otherwise returns true.
final classmethod NotIn(value As %String, items As %String) as %Boolean
Tests if the given value is not among the items in a comma-delimited string.
final classmethod NotInFile(value As %String, filenameSpec As %String) as %Boolean [ SQLProc = NotInFile ]
Projected as the stored procedure: NotInFile
Tests if the given value is not in the specified column in a table-formatted text file. See InFile() for a more detailed description of the options for filenameSpec.
final classmethod NotLike(value As %String, pattern As %String) as %Boolean
Tests if the given value does not satisfy a SQL Like comparison with the given pattern string. In SQL Like patterns, % matches 0 or more characters, and _ matches any single character. Note that an escape character can be specified by appending "%%" to the pattern, e.g. "#%SYSVAR_#_%%%#" to match any value string that starts with "%SYSVAR" followed by any single character, an underscore, and anything else.
final classmethod Pad(value As %String = "", padpos As %Integer = 10, padchar As %String = " ") as %String
Takes string value, adds enough instances of padchar to lengthen the string to padpos characters. If padpos is a negative value, the padding is prepended to the value string.
final classmethod Piece(value As %String = "", delimiter As %String = ",", from As %Integer = 1, to As %Integer = from) as %String
Takes string value, returns the piece delimited by delimiter from from to to. The default value for delimiter is "," and the default values for from and to are both 1. See $Piece for further documentation. An asterisk ('*') in from or to represents the number of delimited pieces in value.
classmethod ReplaceStr(value As %String = "", find As %String = "", replace As %String = "") as %String
Takes string value, replaces occurrences of string find with the string replace and returns the result.
final classmethod Round(value As %Float, digits As %Integer = 0) as %Float
Rounds off the given value to specified number of digits after the decimal point.
final classmethod Rule(RuleName As %String, Context As %RegisteredObject, Activity As %String) as %String [ SQLProc = Rule ]
Projected as the stored procedure: Rule
Evaluate the return value of the rule specified in RuleName with the given Context object and the given Activity label for the Rule Log.
final classmethod Schedule(ScheduleSpec As %String = "", ODBCDateTime As %String = "") as %String [ SQLProc = Schedule ]
Projected as the stored procedure: Schedule
Evaluate the state of the given ScheduleSpec string, named Schedule or Rule at the moment given by ODBCDateTime.
If ScheduleSpec begins with '@' it is a Schedule name or Rule name, otherwise a raw Schedule string.
If ODBCDateTime is blank, the evaluation is done for the current time.
final classmethod StartsWith(value As %String, string As %String) as %Boolean
Tests if the given value starts with the given string.
final classmethod Strip(value As %String = "", action As %String = "", remchar As %String = "", keepchar As %String = "") as %String
Takes string value, removes characters matching categories specified in the action template and the remchar string, excepting characters found in the keepchar string, and returns the result. See $ZStrip for further documentation.
final classmethod SubString(value As %String = "", start As %Integer = "", end As %Integer = "") as %String
Returns a substring of a given value; starting with position start until position end. Empty start will return value irrespective of end. Specifying start position and omitting end position will return from start to the end of the string.
final classmethod ToLower(value As %String = "") as %String
Convert a string supplied in value to lower case.
final classmethod ToUpper(value As %String = "") as %String
Convert a string supplied in value to UPPER case.
final classmethod Translate(value As %String = "", identifier As %String = "", associator As %String = "") as %String
Takes string value, translates each occurrance of a character in string identifier to the character at the corresponding position in string associator and returns the result.
classmethod replace(value As %String = "", find As %String = "", replace As %String = "") as %String
deprecated; legacy from class Ens.DataTransform

Subclasses

FeedbackOpens in a new tab