2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 1
|
|
|
|
---
|
|
|
|
|
|
|
|
# Create table
|
|
|
|
Creates a new table in the base
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Description = "") Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Destination |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Token |
|
|
|
|
| Base | --base | String | Base identifier |
|
|
|
|
| Name | --title | String | New table name |
|
|
|
|
| FieldArray | --fieldsdata | Array of Structure | Array of field descriptions |
|
|
|
|
| Description | --description | String | Table description |
|
|
|
|
|
|
|
|
|
2024-06-06 14:33:52 +02:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Airtable
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
2024-07-10 13:24:11 +02:00
|
|
|
|
|
|
|
Base = "apptm8Xqo7TwMaipQ";
|
2024-06-05 12:19:46 +02:00
|
|
|
TableName = "TestTable2";
|
|
|
|
Description = "NewTable";
|
|
|
|
|
|
|
|
FieldArray = New Array;
|
|
|
|
FieldArray.Add(OPI_Airtable.GetNumberField("Number"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetStringField("String"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetAttachmentField("Attachment"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetCheckboxField("Checkbox"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetDateField("Date"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetPhoneField("Phone"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetEmailField("Email"));
|
|
|
|
FieldArray.Add(OPI_Airtable.GetLinkField("Link"));
|
|
|
|
|
|
|
|
Response = OPI_Airtable.CreateTable(Token, Base, Name, FieldArray, Description); //Map
|
|
|
|
Response = OPI_Tools.JSONString(Response); //JSON string
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint airtable CreateTable --token %token% --base "apptm8Xqo7TwMaipQ" --title %title% --fieldsdata %fieldsdata% --description "NewTable"
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 13:11:17 +02:00
|
|
|
{
|
2024-06-05 12:19:46 +02:00
|
|
|
"id": "tblT64aWyrMUAbUmF",
|
|
|
|
"name": "TestTable2",
|
|
|
|
"description": "NewTable",
|
|
|
|
"primaryFieldId": "fldoHs3kv6RLc8pjo",
|
|
|
|
"fields": [
|
|
|
|
{
|
|
|
|
"type": "number",
|
|
|
|
"options": {
|
|
|
|
"precision": 0
|
|
|
|
},
|
|
|
|
"id": "fldoHs3kv6RLc8pjo",
|
|
|
|
"name": "Number"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "richText",
|
|
|
|
"id": "fldzY5xRHDY7ClKxa",
|
|
|
|
"name": "String"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "multipleAttachments",
|
|
|
|
"options": {
|
|
|
|
"isReversed": false
|
|
|
|
},
|
|
|
|
"id": "fldYHxxXPALKl3yHp",
|
|
|
|
"name": "Attachment"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "checkbox",
|
|
|
|
"options": {
|
|
|
|
"icon": "check",
|
|
|
|
"color": "yellowBright"
|
|
|
|
},
|
|
|
|
"id": "fldRUoggUObfqckXh",
|
|
|
|
"name": "Checkbox"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "date",
|
|
|
|
"options": {
|
|
|
|
"dateFormat": {
|
|
|
|
"name": "iso",
|
|
|
|
"format": "YYYY-MM-DD"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "fldvtwjapJM7s99nN",
|
|
|
|
"name": "Date"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "phoneNumber",
|
|
|
|
"id": "flda4VY8dVd2mbqz9",
|
|
|
|
"name": "Phone"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "email",
|
|
|
|
"id": "fld8ZLKndqBIkT72s",
|
|
|
|
"name": "Email"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "url",
|
|
|
|
"id": "fldqjsCp1c2KaAS53",
|
|
|
|
"name": "Link"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"views": [
|
|
|
|
{
|
|
|
|
"id": "viwX3vEGO5vB2Km4k",
|
|
|
|
"name": "Grid view",
|
|
|
|
"type": "grid"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|