Grammar and types
This guide discusses Tableau's basic grammar, variable declarations, and data types.
Overview
Tableau borrows most of its syntax and types from Protocol Buffers (proto3) and Golang.
Scalar types
Details disccused at Protocol Buffers Proto3 Scalar.
Kind | Types | Default |
---|---|---|
Numbers | int32 , uint32 int64 , uint64 float , double | 0 0 0.0 |
Booleans | bool | false |
Strings | string | "" |
Bytes | bytes | "" |
Composite types
Type | Description |
---|---|
struct | A struct is mapped to a protobuf message. |
list | A list is mapped to a protobuf repeated field. |
map | A map is mapped to a protobuf map field. |
struct
Feature | Description |
---|---|
Horizontal layout | Each scalar field located in one cell. |
Simple incell struct | Each field must be scalar type. It is a comma-separated list of fields. E.g.: 1,test,3.0 .If the data list’s size is not same as struct’s fields, then fields will be filled in order. Fields not configured will be filled with default values due to its scalar type. |
list
Feature | Description |
---|---|
Horizontal layout | This is list’s default layout. Element type can be struct or scalar. |
Vertical layout | List’s element type should be struct. |
Simple incell list | Element type must be scalar. It is a comma-separated list of elements. E.g.: 1,2,3 . |
Scalable | Scalable or dynamic list size. |
Ignore empty element | Smart recognition of empty element at any position. |
map
Feature | Description |
---|---|
Horizontal layout | |
Vertical layout | This is map’s default layout. |
Hash map | Implemented as unordered map or hash map. |
Ordered map | Supported by tableauio/loader. - C++ |
Simple incell map | Both key and value must be scalar type. It is a comma-separated list of key:value pairs.E.g.: 1:10,2:20,3:30 . |
Scalable | Scalable or dynamic map size. |
Ignore empty item | Smart recognition of empty item at any position. |
Enumeration
Feature | Description |
---|---|
Three forms of enum value | 1. Enum value number. 2. Enum value name. 3. Enum value alias name (with EnumValueOptions specified). |
Validation | Auto-check legality of enum values. |
Empty value
Type | Description |
---|---|
scalar | Empty scalar will be emplaced with scalar type’s default value. |
struct | Empty struct will not be spawned if all fields are empty. |
list | Empty list will not be spawned if list’s size is 0. Empty struct will not be appended if list’s element(struct type) is empty. |
map | Empty map will not be spawned if map’s size is 0. Empty struct will not be inserted if map’s value(struct type) is empty. |
nesting | Recursively empty. |