DriveWorks Pro 15: SppConvertNumberCultureInTable [send feedback...]

SppConvertNumberCultureInTable

Returns a table with number formats converted from one culture to another.

Syntax

SppConvertNumberCultureInTable([TableArray], [SourceCulture], [TargetCulture], [ExcludeHeader], [ColumnNumber])

Where:

TableArray is the table to convert from the source culture to the target culture. A table array can be the data in a standard table or the result of a QueryDataValues function for example.

SourceCulture is the culture of the current number (for example fr-FR for French France). Will default to the current culture if left blank.

TargetCulture is the culture to convert the value to (for example en-US for English US). Will default to the current culture if left blank.

ExcludeHeader should be set to True to exclude the header, or False to also format the header row.

ColumnNumber is the index of the column to convert numbers in. The function will convert numbers in the entire table if this argument is left blank, set to 0 or set to a value bigger than the total number of columns.

Examples

RuleMeaning
SppConvertNumberCultureInTable(DWLookupData, "en-US", "fr-FR", TRUE)Will return a new table where numbers, initially formatted with an English number formatting are now following a french number formatting. Numbers in the header row being excluded.
SppConvertNumberCultureInTable(DWLookupData, "en-US", "fr-FR", FALSE)Will return a new table where numbers, initially formatted with an English number formatting are now following a french number formatting. Numbers in the header row being included.
SppConvertNumberCultureInTable(DWLookupData, "fr-FR", "en-US", TRUE, 3)Will return a new table where numbers, initially formatted with a French number formatting are now following an English number formatting. Numbers in the header row being included and only numbers in the third row being converted.
SourceCulture and TargetCulture can be defined by referring to the Table of Language Culture Names from Microsoft.

Example Data Returned as a Table

Let's consider the following data source:

IDNameValueRate
1Product A24.991.5
2Product B138.7
3Product C8.210.6
4Product D1234.8
5Product E3.141582.32

SppConvertNumberCultureInTable(DWLookupData, "en-US", "fr-FR", TRUE, 3) would return the following data, shown as a table:

IDNameValueRate
1Product A24,991.5
2Product B138.7
3Product C8,210.6
4Product D1234.8
5Product E3,141582.32

Example Data Returned as an Array

{"ID","Name","Value","Rate";"1","Product A","24,99","1.5";"2","Product B","13","8.7";"3","Product C","8,2","10.6";"4","Product D","123","4.8";"5","Product E","3,14158","2.32"}

Use cases

This function can be used for two main use-cases:

  1. Converting data stored in a table to a US formatting to perform calculations in DriveWorks.
  2. Converting data stored in a table to the number formatting of the current culture to be displayed on Forms or to export with Documents.

Table of Contents