FuncToChar
- function ExternalLangDef, which serves to specify a transformation expression to a string. This is necessary for correct comparison of values of expressions with string constants. Currently only implemented for MSSQLDataService and OracleDataService.
Use
The function can be used in two ways:
- With two arguments where the first is any expression that returns a value, and the second is a number indicating the length of the resulting string.
-
With three arguments, where the first expression has type
DATETIME
, the second is the length of the string, and the third the number format to display the date. To set the last parameter you can use listExternalLangDef.DateFormats
. It defines the following values: German
(DD.MM.YY)GermanWithCentury
(DD.MM.YYYY)Month
(DD Mon YY abbreviated month name)MonthWithCentury
(DD Mon YYYY)Time
(hh:mi:ss - time)
In addition, you can use other formats by specifying their number. Full list is here (this is possible only for MSSQLDataService.
Example usage
Getting the expression that causes the date to string and compare with the function LIKE
var stringDate = _langdef.GetFunction(
_langdef.funcToChar,
new VariableDef(_langdef.DateTimeType, propertyName),
10, // The length of the string containing the date in format 'DD.MM.YYYY'
ExternalLangDef.DateFormats.GermanWithCentury);
return _langdef.GetFunction(
_langdef.funcLike,
stringDate,
string.Format("%{0}%", searchValue.Trim().ToLower()));