ToString function

The ToString function converts the value to its left to a string. This function appears in the Statement Editor for Integer, Float, and Date data types. For Float and Date columns, the ToString function can be used in the Statement Text Editor .

The ToString function is useful for importing numeric data into model fields in your DDM using macros.

This function uses two parameters:

Format: Optional, however it is recommended to use when converting from date time values. Use this parameter to format the result using .NET formatting patterns. Defaults to the local format in the user's browser.

Culture: Optional, however, it is best practice to use this parameter when converting from a float or date time. Use this parameter to specify the formatting used to store the data. For example:

  • whether decimal values use a comma or a period
  • the culture-specific formatting for dates

Valid values for the Culture parameter are pulled from .NET’s list of available culture codes. When you edit the function using the Statement Editor interface, a number of commonly used values will display when you select the Culture field. You can select a value or type the value you need. You can also add the Culture value using the Statement Text Editor.

Note: If you use the ToString function, users cannot edit the values (which are now generated by the ToString function). If users need to edit values on a grid, use column formatting, which also includes more robust formatting.

Interaction between the parameters

In the ToString function, the interaction of the Formatting and Culture parameters is as follows:

  • If you omit both parameters, the existing conversion method is done for backwards compatibility.
  • If only Format is specified, then it is used and Culture defaults to the culture from the browser or LLAPI Culture value. Note that this is a .NET format string.
  • If only Culture is specified, the format defaults based on the data type.
  • If both Format and Culture are specified, they are both used.

Last modified: Friday May 12, 2023

Is this useful?