Explore Categories

 

 PDF

String Functions

$$CaseConvert

In TDL, the function $$Upper has been used to convert the string expressions to upper case, but there were no functions available for other conversions like Lower case, Title Case, etc. To overcome the difficulty of converting the string to Lower case, Title case, etc., a new function $$CaseConvert has been introduced, to convert the case of the given expression to the specified case format. This function will return a string expression in the converted format.

This function is very useful when one needs to follow the case rules to display the Name of the company, Name of the bank, etc.

Syntax

$$CaseConvert : <CaseKeyword> : <Expression>

Where,

<CaseKeyword> can be All Capital, Upper Case, All Lower, Lower Case, Small Case, First Upper Case, Title Case, TitleCaseExact, Normal, Proper Case, etc.

  • All Capital/Upper Case converts the input expression to upper case.
  • All Lower/Lower Case/Small Case converts the input expression to lower case.
  • First Upper Case converts the first letter of the first word in a sentence to upper case. Other characters will remain as they are.
  • Title Case converts the input expression to Title case, i.e., the principal words should start with capital letters.
  • It will not convert the prepositions, articles or conjunctions, unless one is the first word.
  • It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. For this subset of words, the original strings’ cases will be preserved.
  • TitleCaseExact converts the input expression to Title case, i.e., the principal words will start with capital letters.
  • It will not convert the prepositions, articles or conjunctions, unless one is the first word.
  • It will ignore a subset of words from capitalization like the, an, and, at, by, to, in, of, for, on, cm, cms, mm, inch, inches, ft, x, dt, eis, dss, with, etc. This subset of words will be converted to small case.
  • Proper Case converts the input expression to Title case, i.e., all the words in a sentence should start with capital letters.
  • Normal preserves the input expression as it is.

<Expression> is any expression of type ‘String’.

Example: 1

To convert the expression to upper case:

[Field : String Convert]

Set as : $$CaseConvert:UpperCase:“Tally solutions Pvt. Ltd.”

In this example, the function returns “TALLY SOLUTIONS PVT. LTD.” in the field ‘String Convert’.

Example: 2

To convert the expression to Lower case:

[Field : String Convert]

Set as : $$CaseConvert:LowerCase:“Tally Solutions Pvt. Ltd.”

Here, the function returns, “tally solutions pvt. ltd.” in the field ‘String Convert’.

Example: 3

To convert the expression to Title Case:

[Field: String Convert]

Set as : $$CaseConvert:TitleCase:“To convert the striNg to Title case”

Here, the function returns “To Convert the String to Title Case” in the field ‘String Convert’.

Example: 4

To convert the expression to Title Case Exact:

[Field : String Convert]

Set as : $$CaseConvert:TitleCaseExact:“To convert the string to Title case”

Here, the function returns “ To Convert the String to Title Case” in the field ‘String Convert’.

Example: 5

To convert the expression to first upper case:

[Field : String Convert]

Set as : $$CaseConvert:FirstUpperCase:“Tally solutions pvt. ltd.”

Here, the function returns “Tally solutions pvt. ltd.” in the field ‘String Convert’.

$$IsAnyEmpty

When you want to check if there is an expression that evaluates to empty among a set of expressions, you can use the function IsAnyEmpty. This function evaluates the expression parameters in the sequence specified in the code. It will return True, the moment an expression evaluates to empty and ignores the subsequent expressions.

Syntax

$$IsAnyEmpty:<Expression1>:<Expression2>:…..:<ExpressionN>

Where,

<Expressions> can be variables, formulae, functions, etc.

Example

[Collection: TNOldAnnexIASummaryWithoutError]

Compute Var : HasError : Logical :$$IsAnyEmpty:##svRefNo:##svRefDate:##svLorryDate

Ensure that the sequence of parameters is such that higher the probability of an expression being Empty, earlier in the order they should be placed.

Previously, to evaluate more than one expression for empty, you had to use $$IsEmpty along with OR operator. Now, you can just use the new function to evaluate multiple expression in a single line.

 

$$VarRangeValue

This function gets a list of variable values, separated by the specified separator character. If no separator character is specified, comma (,) is taken as the separator character by default.

Syntax

$$VarRangeValue : <Variable Specification> [:<Separator Character> [:<Start Position> [:<End Position>]]]

Where,

<Variable Specification> is the simple variable specification.

<Separator Character> is the separator character.

<Start Position> is the index which denotes the starting position.

<End Position> is the index which denotes the ending position.

Specifying Start and End Positions is optional. If not specified, the function will return all the values of the specified Repeat variable separated by comma(,).

If Start and End Positions are specified, the function will return the values of repeat variable within the Specified index Range. Again, specifying End Position is optional. If the End Position is not specified, the function will return the entire set of values from the starting position.

Example

$$VarRangeValue:SVFromDate

In this example, the function returns the entire set of values of the Repeat Variable SVFromDate.

$$VarRangeValue:SVFromDate:”,”:1:5

Here, the function returns the value of specified index range (1 to 5) of the Repeat Variable SVFromDate

$$VarRangeValue:SVFromDate:”,”:3

The entire set of values from Starting Index position of the repeat variable SVFromDate are returned.

Post a Comment

Is this information useful?
YesNo
Helpful?