# JSColumnObject

## Overview

The `JSColumnObject` is a scripting object that represents a data-source column created through `JSTableObject.createNewColumn(...)`. It extends `JSColumn` by providing additional setter methods for modifying the column's properties, such as nullability, flags, sequence types, and row identifier types. These changes are not immediately applied but take effect only after invoking `server.synchronizeWithDB()`.

This object allows developers to customize columns further during table creation, including defining primary key configurations, database sequences, and UUID generation settings. Flags can also be set or cleared to mark columns as excluded, tenant-specific, or native type columns.

## Constants Summarized

| Type                                                | Name                                     | Summary                                                                   |
| --------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------- |
| [Number](../../../servoycore/dev-api/js-lib/number) | [DATABASE\_IDENTITY](#database_identity) | Constant used when setting or getting the sequence type of columns.       |
| [Number](../../../servoycore/dev-api/js-lib/number) | [DATABASE\_SEQUENCE](#database_sequence) | Constant used when setting or getting the sequence type of columns.       |
| [Number](../../../servoycore/dev-api/js-lib/number) | [DATETIME](#datetime)                    | Constant used when setting or getting the type of columns.                |
| [Number](../../../servoycore/dev-api/js-lib/number) | [EXCLUDED\_COLUMN](#excluded_column)     | Constant used when setting or getting the flags of columns.               |
| [Number](../../../servoycore/dev-api/js-lib/number) | [INTEGER](#integer)                      | Constant used when setting or getting the type of columns.                |
| [Number](../../../servoycore/dev-api/js-lib/number) | [MEDIA](#media)                          | Constant used when setting or getting the type of columns.                |
| [Number](../../../servoycore/dev-api/js-lib/number) | [NATIVE\_COLUMN](#native_column)         | Constant used when setting or getting the flags of columns.               |
| [Number](../../../servoycore/dev-api/js-lib/number) | [NONE](#none)                            | Constant for column information indicating unset values.                  |
| [Number](../../../servoycore/dev-api/js-lib/number) | [NUMBER](#number)                        | Constant used when setting or getting the type of columns.                |
| [Number](../../../servoycore/dev-api/js-lib/number) | [PK\_COLUMN](#pk_column)                 | Constant used when setting or getting the row identifier type of columns. |
| [Number](../../../servoycore/dev-api/js-lib/number) | [ROWID\_COLUMN](#rowid_column)           | Constant used when setting or getting the row identifier type of columns. |
| [Number](../../../servoycore/dev-api/js-lib/number) | [TENANT\_COLUMN](#tenant_column)         | Constant used when setting or getting the flags of columns.               |
| [Number](../../../servoycore/dev-api/js-lib/number) | [TEXT](#text)                            | Constant used when setting or getting the type of columns.                |
| [Number](../../../servoycore/dev-api/js-lib/number) | [UUID\_COLUMN](#uuid_column)             | Constant used when setting or getting the flags of columns.               |
| [Number](../../../servoycore/dev-api/js-lib/number) | [UUID\_GENERATOR](#uuid_generator)       | Constant used when setting or getting the sequence type of columns.       |

## Properties Summarized

| Type                                                  | Name                                    | Summary                                           |
| ----------------------------------------------------- | --------------------------------------- | ------------------------------------------------- |
| [Boolean](../../../servoycore/dev-api/js-lib/boolean) | [allowNull](#allownull)                 | Get or set the allow-null flag of a new column.   |
| [Number](../../../servoycore/dev-api/js-lib/number)   | [rowIdentifierType](#rowidentifiertype) | Get or set the row identifier type of the column. |
| [Number](../../../servoycore/dev-api/js-lib/number)   | [sequenceType](#sequencetype)           | Get or set the sequence type of the column.       |

## Methods Summarized

| Type                                                            | Name                                                                           | Summary                                                                                                                     |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getDataProviderID()](#getdataproviderid)                                      | Get the data provider id for this column (which is the same as name if not explicitly defined otherwise).                   |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getDefaultFormat()](#getdefaultformat)                                        | Get the default format of the column.                                                                                       |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getDescription()](#getdescription)                                            | Get the description property of the column.                                                                                 |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getForeignType()](#getforeigntype)                                            | Get the foreign type of the column.                                                                                         |
| [Number](../../../servoycore/dev-api/js-lib/number)             | [getLength()](#getlength)                                                      | Get the length of the column as reported by the JDBC driver.                                                                |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getName()](#getname)                                                          | Get the name of the column as used by Servoy.                                                                               |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getQualifiedName()](#getqualifiedname)                                        | Get the qualified name (including table name) of the column as known by the database.                                       |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getQuotedSQLName()](#getquotedsqlname)                                        | Returns a quoted version of the column name, if necessary, as defined by the actual database used.                          |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getRawTitle()](#getrawtitle)                                                  | Get the raw title property of the column.                                                                                   |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getSQLName()](#getsqlname)                                                    | Get the name of the column as known by the database.                                                                        |
| [Number](../../../servoycore/dev-api/js-lib/number)             | [getSQLType()](#getsqltype)                                                    | Get the raw JDBC type of the column, which allows to check database specific types, like sting/byte column type variations. |
| [Number](../../../servoycore/dev-api/js-lib/number)             | [getScale()](#getscale)                                                        | Get the scale of the column as reported by the JDBC driver.                                                                 |
| [JSTable](../../../servoycore/dev-api/database-manager/jstable) | [getTable()](#gettable)                                                        | Get the JSTable of this column.                                                                                             |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getTitle()](#gettitle)                                                        | Get the title property of the column.                                                                                       |
| [Number](../../../servoycore/dev-api/js-lib/number)             | [getType()](#gettype)                                                          | Get the JDBC type of the column.                                                                                            |
| [String](../../../servoycore/dev-api/js-lib/string)             | [getTypeAsString()](#gettypeasstring)                                          | Get the name JDBC type of the column.                                                                                       |
| [Boolean](../../../servoycore/dev-api/js-lib/boolean)           | [hasFlag(flag)](#hasflag-flag)                                                 | Check a flag of the column.                                                                                                 |
| void                                                            | [setDatabaseSequenceName(sequenceName)](#setdatabasesequencename-sequencename) | Set the database sequence name of the column, used for columns with sequence type JSColumn.                                 |
| void                                                            | [setFlag(flag, set)](#setflag-flag-set)                                        | Set or clear a flag of a new column.                                                                                        |

## Constants Detailed

### DATABASE\_IDENTITY

Constant used when setting or getting the sequence type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
	// handle column with no sequence
break;

case JSColumn.UUID_GENERATOR:
	// handle uuid generated column
break;
}
```

### DATABASE\_SEQUENCE

Constant used when setting or getting the sequence type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
	// handle column with no sequence
break;

case JSColumn.UUID_GENERATOR:
	// handle uuid generated column
break;
}
```

### DATETIME

Constant used when setting or getting the type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### EXCLUDED\_COLUMN

Constant used when setting or getting the flags of columns.\
This flag identifies columns that are skipped in the sql.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
	// handle uuid column
}
```

### INTEGER

Constant used when setting or getting the type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### MEDIA

Constant used when setting or getting the type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### NATIVE\_COLUMN

Constant used when setting or getting the flags of columns.\
This flag identifies columns that are marked as a native type column (for example uniqueidentifier).

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
	// handle uuid column
}
```

### NONE

Constant for column information indicating unset values.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
	// handle column with no sequence
break;

case JSColumn.UUID_GENERATOR:
	// handle uuid generated column
break;
}
```

### NUMBER

Constant used when setting or getting the type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### PK\_COLUMN

Constant used when setting or getting the row identifier type of columns.\
This value identifies columns that are defined as primary key in the database.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getRowIdentifierType())
{
case JSColumn.NONE:
	// handle normal column
break;

case JSColumn.PK_COLUMN:
	// handle database pk column
break;

case JSColumn.ROWID_COLUMN:
	// handle developer defined pk column
break;
}
```

### ROWID\_COLUMN

Constant used when setting or getting the row identifier type of columns.\
This value identifies columns that are defined as primary key by the developer (but not in the database).

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getRowIdentifierType())
{
case JSColumn.NONE:
	// handle normal column
break;

case JSColumn.PK_COLUMN:
	// handle database pk column
break;

case JSColumn.ROWID_COLUMN:
	// handle developer defined pk column
break;
}
```

### TENANT\_COLUMN

Constant used when setting or getting the flags of columns.\
This flag identifies columns that are marked as a tenant column.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
	// handle uuid column
}
```

### TEXT

Constant used when setting or getting the type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### UUID\_COLUMN

Constant used when setting or getting the flags of columns.\
This flag identifies columns whose values are treated as UUID.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
	// handle uuid column
}
```

### UUID\_GENERATOR

Constant used when setting or getting the sequence type of columns.

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getSequenceType())
{
case JSColumn.NONE:
	// handle column with no sequence
break;

case JSColumn.UUID_GENERATOR:
	// handle uuid generated column
break;
}
```

## Properties Detailed

### allowNull

Get or set the allow-null flag of a new column.\
Note that when a column is added to an existing table, allowNull will always be set.\
For a primary key column, the allowNull flag will be always off, for other columns the flag is set by default.

**Type**\
[Boolean](../../../servoycore/dev-api/js-lib/boolean)

**Sample**

```js
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	var table = server.createNewTable("users");
	if (table)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		var c = table.createNewColumn("name", JSColumn.TEXT, 100);
		c.allowNull = false
		table.createNewColumn("age", JSColumn.INTEGER, 0);
		table.createNewColumn("last_login", JSColumn.DATETIME, 0);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table successfully created.");
		else application.output("Table not created.");
	}
}
```

### rowIdentifierType

Get or set the row identifier type of the column.\
The sequence type is one of:\
&#x20;\- JSColumn.PK\_COLUMN\
&#x20;\- JSColumn.ROWID\_COLUMN\
&#x20;\- JSColumn.NONE

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	// users has uuid pk
	var table = server.createNewTable("users");
	if (table)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		table.createNewColumn("name", JSColumn.TEXT, 100);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table users successfully created.");
		else application.output("Table users not created.");
	}

	// groups has database sequence pk
	table = server.createNewTable("groups");
	if (table)
	{
		pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.sequenceType = JSColumn.DATABASE_SEQUENCE
		pk.setDatabaseSequenceName('mygroupsequence')
		table.createNewColumn("name", JSColumn.TEXT, 100);
		result = server.synchronizeWithDB(table);
		if (result) application.output("Table groups successfully created.");
		else application.output("Table groups not created.");
	}
}
```

### sequenceType

Get or set the sequence type of the column.\
The sequence type is one of:\
&#x20;\- JSColumn.NONE\
&#x20;\- JSColumn.SERVOY\_SEQUENCE\
&#x20;\- JSColumn.DATABASE\_SEQUENCE\
&#x20;\- JSColumn.DATABASE\_IDENTITY\
&#x20;\- JSColumn.UUID\_GENERATOR;

**Type**\
[Number](../../../servoycore/dev-api/js-lib/number)

**Sample**

```js
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	// users has uuid pk
	var table = server.createNewTable("users");
	if (table)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		table.createNewColumn("name", JSColumn.TEXT, 100);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table users successfully created.");
		else application.output("Table users not created.");
	}

	// groups has database sequence pk
	table = server.createNewTable("groups");
	if (table)
	{
		pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.sequenceType = JSColumn.DATABASE_SEQUENCE
		pk.setDatabaseSequenceName('mygroupsequence')
		table.createNewColumn("name", JSColumn.TEXT, 100);
		result = server.synchronizeWithDB(table);
		if (result) application.output("Table groups successfully created.");
		else application.output("Table groups not created.");
	}
}
```

## Methods Detailed

### getDataProviderID()

Get the data provider id for this column (which is the same as name if not explicitly defined otherwise).

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String dataprovider id.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var dataProviderId = column.getDataProviderID()
```

### getDefaultFormat()

Get the default format of the column.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String column default format.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var format = column.getDefaultFormat()
```

### getDescription()

Get the description property of the column.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String column description.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var desc = column.getDescription()
```

### getForeignType()

Get the foreign type of the column.\
The foreign type can be defined design time as a foreign key reference to another table.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String foreign type.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var foreignType = column.getForeignType()
if (foreignType != null)
{
	var fkTable = databaseManager.getTable('example_data', foreignType)
}
```

### getLength()

Get the length of the column as reported by the JDBC driver.

**Returns:** [Number](../../../servoycore/dev-api/js-lib/number) int column length.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
if (column.getLength() < 10)
{
	 // handle short column
}
```

### getName()

Get the name of the column as used by Servoy.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String column name

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var colName = column.getName()
```

### getQualifiedName()

Get the qualified name (including table name) of the column as known by the database.\
The name is quoted, if necessary, as defined by the actual database used.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String qualified column name.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var qualifiedSqlName = column.getQualifiedName()
```

### getQuotedSQLName()

Returns a quoted version of the column name, if necessary, as defined by the actual database used.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) column name, quoted if needed.

**Sample**

```js
//use with the raw SQL plugin:
//if the table name contains characters that are illegal in sql, the table name will be quoted
var jsTable = databaseManager.getTable('udm', 'campaigns')
var quotedTableName = jsTable.getQuotedSQLName()
var jsColumn = jsTable.getColumn('active')
var quotedColumnName = jsColumn.getQuotedSQLName()
plugins.rawSQL.executeSQL('udm',  quotedTableName,  'select * from ' + quotedTableName + ' where ' + quotedColumnName + ' = ?', [1])
```

### getRawTitle()

Get the raw title property of the column.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String column title.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var title = column.getRawTitle()
```

### getSQLName()

Get the name of the column as known by the database.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String sql name

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var sqlName = column.getSQLName()
```

### getSQLType()

Get the raw JDBC type of the column, which allows to check database specific types, like sting/byte column type variations.

**Returns:** [Number](../../../servoycore/dev-api/js-lib/number) int sql type.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var sqlType = column.getSQLType();
```

### getScale()

Get the scale of the column as reported by the JDBC driver.

**Returns:** [Number](../../../servoycore/dev-api/js-lib/number) int column scale.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var scale = column.getScale()
```

### getTable()

Get the JSTable of this column.

**Returns:** [JSTable](../../../servoycore/dev-api/database-manager/jstable) table The JSTable of this column.

### getTitle()

Get the title property of the column. If title is null will return column name.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String column title.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customername')
var title = column.getTitle()
```

### getType()

Get the JDBC type of the column.\
The type reported by the JDBC driver will be mapped to one of:\
&#x20;\- JSColumn.DATETIME\
&#x20;\- JSColumn.TEXT\
&#x20;\- JSColumn.NUMBER\
&#x20;\- JSColumn.INTEGER\
&#x20;\- JSColumn.MEDIA

**Returns:** [Number](../../../servoycore/dev-api/js-lib/number) int sql type.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
switch (column.getType())
{
case JSColumn.TEXT:
	// handle text column
break;

case JSColumn.NUMBER:
case JSColumn.INTEGER:
	// handle numerical column
break;
}
```

### getTypeAsString()

Get the name JDBC type of the column.\
The same mapping as defined in JSColumn.getType() is applied.

**Returns:** [String](../../../servoycore/dev-api/js-lib/string) String sql name.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
var typeName = column.getTypeAsString()
```

### hasFlag(flag)

Check a flag of the column.\
The flags are a bit pattern consisting of 1 or more of the following bits:\
&#x20;\- JSColumn.UUID\_COLUMN\
&#x20;\- JSColumn.EXCLUDED\_COLUMN\
&#x20;\- JSColumn.TENANT\_COLUMN\
&#x20;\- JSColumn.NATIVE\_COLUMN

**Parameters**

* [Number](../../../servoycore/dev-api/js-lib/number) **flag** ;

**Returns:** [Boolean](../../../servoycore/dev-api/js-lib/boolean) boolean whether flag is set.

**Sample**

```js
var table = databaseManager.getTable('db:/example_data/orders')
var column = table.getColumn('customerid')
if (column.hasFlag(JSColumn.UUID_COLUMN))
{
	// handle uuid column
}
```

### setDatabaseSequenceName(sequenceName)

Set the database sequence name of the column, used for columns with sequence type JSColumn.DATABASE\_SEQUENCE.

**Parameters**

* [String](../../../servoycore/dev-api/js-lib/string) **sequenceName** the sequence name

**Returns:** void

**Sample**

```js
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	// users has uuid pk
	var table = server.createNewTable("users");
	if (table)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use <JSColumn.TEXT, 36> for UUIDs)
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		table.createNewColumn("name", JSColumn.TEXT, 100);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table users successfully created.");
		else application.output("Table users not created.");
	}

	// groups has database sequence pk
	table = server.createNewTable("groups");
	if (table)
	{
		pk = table.createNewColumn("id", JSColumn.INTEGER, 0);
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.sequenceType = JSColumn.DATABASE_SEQUENCE
		pk.setDatabaseSequenceName('mygroupsequence')
		table.createNewColumn("name", JSColumn.TEXT, 100);
		result = server.synchronizeWithDB(table);
		if (result) application.output("Table groups successfully created.");
		else application.output("Table groups not created.");
	}
}
```

### setFlag(flag, set)

Set or clear a flag of a new column.\
The flags are a bit pattern consisting of 1 or more of the following bits:\
&#x20;\- JSColumn.UUID\_COLUMN;\
&#x20;\- JSColumn.EXCLUDED\_COLUMN;

**Parameters**

* [Number](../../../servoycore/dev-api/js-lib/number) **flag** the flag to set
* [Boolean](../../../servoycore/dev-api/js-lib/boolean) **set** true for set flag, false for clear flag

**Returns:** void

**Sample**

```js
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	var table = server.createNewTable("users");
	if (table)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		var c = table.createNewColumn("name", JSColumn.TEXT, 100);
		c.allowNull = false
		table.createNewColumn("age", JSColumn.INTEGER, 0);
		table.createNewColumn("last_login", JSColumn.DATETIME, 0);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table successfully created.");
		else application.output("Table not created.");
	}
}
```

***
