Home Search

DriveWorks Pro 22
TableFormat

Send Feedback

TableFormat

Applies a format to all values in a specified column of a table.

Syntax

TableFormat(Table or Table Name As Table, Column Index As Double, Format As String)

Where:

Table or Table Name is the Table to format.

Column Index is the number of the column in which the formatting will be applied.

Format is the formatting string to use. Where:

  • "0000.00" - Formats a number with up to four leading zeros, and two decimal places.
  • "#.00" - Formats a number to two decimal places.
  • "DDDDMMYY-HHMMSS" - Formats a date.
  • "0%" or "0.0%" - Formats the table column as a percentage (0.0% requires the same quantity of decimal places as the text being formatted.

Examples

RuleMeaning
TableFormat(DWLookupCurrency,4,"MMM-YY")Will return an array from the table Data, with the values in column 4 formatted as a date. See Example Outcome 1 below.
TableFormat(DWLookupCurrency,3,"0.0%")Will return an array from the table Data, with the values in column 3 formatted as a percentage. See Example Outcome 2 below.

Example Data

Currency Table

CountryCurrencyRateDate
FranceEuro1.329/03/15
United StatesDollar1.418/02/15
GermanyEuro1.322/01/15
United KingdomPound115/07/14

Example Outcome 1

Currency Table

CountryCurrencyRateDate
FranceEuro1.3Mar-15
United StatesDollar1.4Feb-15
GermanyEuro1.3Jan-15
United KingdomPound1Jul-14

DriveWorks will return the table above as an array, which will look like:

Table returned as an Array
{"Country","Currency","Rate","Date";"France","Euro","1.3","Mar-15";"United States","Dollar","1.4","Feb-15";"Germany","Euro","1.3","Jan-15";"United Kingdom","Pound","1","Jul-14"}

Example Outcome 2

Currency Table

CountryCurrencyRateDate
FranceEuro1.3%29/03/15
United StatesDollar1.4%18/02/15
GermanyEuro1.3%22/01/15
United KingdomPound1.0%15/07/14

DriveWorks will return the table above as an array, which will look like:

Table returned as an Array
{"Country","Currency","Rate","Date";"France","Euro","1.3%","29/03/2015";"United States","Dollar","1.4%","18/02/2015";"Germany","Euro","1.3%","22/01/2015";"United Kingdom","Pound","1.0%","15/07/2014"}