Column Class

Describes a column on a DataSource.Table.

Namespace

DataSource

Usage

A list of column metadata is provided by the DataSource.Connection class when the sync() method is invoked. Each column can become a field on an external object.

The metadata is stored in Salesforce. Updating the Apex code to return new or updated values for the column metadata doesn’t automatically update the stored metadata in Salesforce.

Column Properties

The following are properties for Column.

decimalPlaces

If the data type is numeric, the number of decimal places to the right of the decimal point.

Signature

public Integer decimalPlaces {get; set;}

Property Value

Type: Integer

description

Description of what the column represents.

Signature

public String description {get; set;}

Property Value

Type: String

filterable

Whether a result set can be filtered based on the values of the column.

Signature

public Boolean filterable {get; set;}

Property Value

Type: Boolean

label

User-friendly name for the column that appears in the Salesforce user interface.

Signature

public String label {get; set;}

Property Value

Type: String

length

If the column is a string data type, the number of characters in the column. If the column is a numeric data type, the total number of digits on both sides of the decimal point, but excluding the decimal point.

Signature

public Integer length {get; set;}

Property Value

Type: Integer

name

Name of the column in the external system.

Signature

public String name {get; set;}

Property Value

Type: String

referenceTargetField

API name of the custom field on the parent object whose values are compared against this column’s values. Matching values identify related records in an indirect lookup relationship. Applies only when the column’s data type is INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

Signature

public String referenceTargetField {get; set;}

Property Value

Type: String

referenceTo

API name of the parent object in the relationship that’s represented by this column. Applies only when the column’s data type is LOOKUP_TYPE, EXTERNAL_LOOKUP_TYPE, or INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

Signature

public String referenceTo {get; set;}

Property Value

Type: String

sortable

Whether a result set can be sorted based on the values of the column via an ORDER BY clause.

Signature

public Boolean sortable {get; set;}

Property Value

Type: Boolean

type

Data type of the column.

Signature

public DataSource.DataType type {get; set;}

Property Value

Type: DataSource.DataType

Column Methods

The following are methods for Column.

boolean(name)

Returns a new column of data type BOOLEAN_TYPE.

Signature

public static DataSource.Column boolean(String name)

Parameters

name
Type: String
Name of the column.

Return Value

Type: DataSource.Column

externalLookup(name, domain)

Returns a new column of data type EXTERNAL_LOOKUP_TYPE.

Signature

public static DataSource.Column externalLookup(String name, String domain)

Parameters

name
Type: String
Name of the column.
domain
Type: String
API name of the parent object in the external lookup relationship.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.EXTERNAL_LOOKUP_TYPE
length 255
decimalPlaces 0
referenceTo domain
referenceTargetField null

get(name, label, description, isSortable, isFilterable, type, length, decimalPlaces, referenceTo, referenceTargetField)

Returns a new column with the ten specified Column property values.

Signature

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length, Integer decimalPlaces, String referenceTo, String referenceTargetField)

Parameters

See Column Properties for information about each parameter.

name
Type: String
label
Type: String
description
Type: String
isSortable
Type: Boolean
isFilterable
Type: Boolean
type
Type: DataSource.DataType
length
Type: Integer
decimalPlaces
Type: Integer
referenceTo
Type: String
referenceTargetField
Type: String

Return Value

Type: DataSource.Column

get(name, label, description, isSortable, isFilterable, type, length, decimalPlaces)

Returns a new column with the eight specified Column property values.

Signature

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length, Integer decimalPlaces)

Parameters

See Column Properties for information about each parameter.

name
Type: String
label
Type: String
description
Type: String
isSortable
Type: Boolean
isFilterable
Type: Boolean
type
Type: DataSource.DataType
length
Type: Integer
decimalPlaces
Type: Integer

Return Value

Type: DataSource.Column

get(name, label, description, isSortable, isFilterable, type, length)

Returns a new column with the seven specified Column property values.

Signature

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length)

Parameters

See Column Properties for information about each parameter.

name
Type: String
label
Type: String
description
Type: String
isSortable
Type: Boolean
isFilterable
Type: Boolean
type
Type: DataSource.DataType
length
Type: Integer

Return Value

Type: DataSource.Column

indirectLookup(name, domain, targetField)

Returns a new column of data type INDIRECT_LOOKUP_TYPE.

Signature

public static DataSource.Column indirectLookup(String name, String domain, String targetField)

Parameters

name
Type: String
Name of the column.
domain
Type: String
API name of the parent object in the indirect lookup relationship.
targetField
Type: String
API name of the custom field on the parent object whose values are compared against this column’s values. Matching values identify related records in an indirect lookup relationship.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.INDIRECT_LOOKUP_TYPE
length 255
decimalPlaces 0
referenceTo domain
referenceTargetField targetField

integer(name, length)

Returns a new numeric column with no decimal places using the specified name and length.

Signature

public static DataSource.Column integer(String name, Integer length)

Parameters

name
Type: String
The column name.
length
Type: Integer
The column length.

Return Value

Type: DataSource.Column

lookup(name, domain)

Returns a new column of data type LOOKUP_TYPE.

Signature

public static DataSource.Column lookup(String name, String domain)

Parameters

name
Type: String
Name of the column.
domain
Type: String
API name of the parent object in the lookup relationship.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.LOOKUP_TYPE
length 255
decimalPlaces 0
referenceTo domain
referenceTargetField null

number(name, length, decimalPlaces)

Returns a new column of data type NUMBER_TYPE.

Signature

public static DataSource.Column number(String name, Integer length, Integer decimalPlaces)

Parameters

See Column Properties for information about each parameter.

name
Type: String
length
Type: Integer
decimalPlaces
Type: Integer

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.NUMBER_TYPE
length length
decimalPlaces decimalPlaces

text(name, label, length)

Returns a new column of data type STRING_SHORT_TYPE or STRING_LONG_TYPE, with the specified name, label, and length.

Signature

public static DataSource.Column text(String name, String label, Integer length)

Parameters

name
Type: String
Name of the column.
label
Type: String
User-friendly name for the column that appears in the Salesforce user interface.
length
Type: Integer
Number of characters allowed in the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label label
description label
isSortable true
isFilterable true
type DataSource.DataType.STRING_SHORT_TYPE if length is 255 or less

DataSource.DataType.STRING_LONG_TYPE if length is greater than 255

length length
decimalPlaces 0

text(name, length)

Returns a new column of data type STRING_SHORT_TYPE or STRING_LONG_TYPE, with the specified name and length.

Signature

public static DataSource.Column text(String name, Integer length)

Parameters

name
Type: String
Name of the column.
length
Type: Integer
Number of characters allowed in the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.STRING_SHORT_TYPE if length is 255 or less

DataSource.DataType.STRING_LONG_TYPE if length is greater than 255

length length
decimalPlaces 0

text(name)

Returns a new column of data type STRING_SHORT_TYPE with the specified name and the length of 255 characters.

Signature

public static DataSource.Column text(String name)

Parameters

name
Type: String
Name of the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.STRING_SHORT_TYPE
length 255
decimalPlaces 0

textarea(name)

Returns a new column of data type STRING_LONG_TYPE with the specified name and the length of 32,000 characters.

Signature

public static DataSource.Column textarea(String name)

Parameters

name
Type: String
Name of the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.STRING_LONG_TYPE
length 32000
decimalPlaces 0

url(name, length)

Returns a new column of data type URL_TYPE with the specified name and length.

Signature

public static DataSource.Column url(String name, Integer length)

Parameters

name
Type: String
Name of the column.
length
Type: Integer
Number of characters allowed in the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.URL_TYPE
length length
decimalPlaces 0

url(name)

Returns a new column of data type URL_TYPE with the specified name and the length of 1,000 characters.

Signature

public static DataSource.Column url(String name)

Parameters

name
Type: String
Name of the column.

Return Value

Type: DataSource.Column

The returned column has these property values.
Property Value
name name
label name
description name
isSortable true
isFilterable true
type DataSource.DataType.URL_TYPE
length 1000
decimalPlaces 0