Home Search

DriveWorks Pro 22
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 or is set to 0 or a value bigger than the total number of columns.

Examples

RuleResultMeaning
SppConvertNumberCultureInTable(DWLookupProducts, "en-GB", "de-DE", TRUE){"ID","Name","Value","Rate";"1","Product A","24,99","1,5";"2","Product B","13","8,7";"3","Product C","8200","10,6";"4","Product D","123","4,8";"5","Product E","3141,59","2,32"}Will return a new Array where numbers, initially formatted with an English number formatting are now following a German number formatting. Numbers in the header row being excluded.
SppConvertNumberCultureInTable(DWLookupProducts, "en-US", "fr-FR", FALSE, 3){"ID","Name","Value","Rate";"1","Product A","24,99","1.50";"2","Product B","13","8.70";"3","Product C","8200","10.60";"4","Product D","123","4.80";"5","Product E","3141,59","2.32"}Will return a new table where numbers in the third column, initially formatted with English formatting are now following a French number formatting.

SourceCulture and TargetCulture can be defined by referring to the Table of Language Culture Names from Microsoft.

Example Data

IDNameValueRate
1Product A24.991.50
2Product B13.008.70
3Product C8200.0010.60
4Product D123.004.80
5Product E3141.592.32

Example Array Result

IDNameValueRate
1Product A24,991,50
2Product B138,7
3Product C820010,6
4Product D1234,8
5Product E3141,592,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.