# Other

### Cast

Converts the type of a variable. Consider using the "retype" step for additional functionality. –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#cast)

```sql
CASE WHEN @expression IS NULL THEN NULL ELSE COALESCE(SAFE_CAST(@expression AS @castType), ERROR(FORMAT('Could not cast @expression to @castType, encountered value: %t', @expression))) END
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |
| `@castType` | [enum](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#enum)         | any of: `INT64`, `FLOAT64`, `STRING`, `TIME`, `DATETIME`, `DATE`, `BOOLEAN`              | true     | *(Choose a type)*   |
| `@safe`     | [boolean](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#boolean)   | any [boolean](https://docs.redivis.com/reference/datasets/variables#boolean)             | true     | -                   |

### Coalesce

Takes the first non-null value of a set of values. –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#coalesce)

```sql
COALESCE(@expression)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                     | Allowed values                                                                           | Required | Placeholder (in UI) |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable)s or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)s | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### Constant

Create a constant value as a variable –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#constant)

```sql
undefined
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name       | Type                                                                                                                                                                                                                                                   | Allowed values                                                                           | Required | Placeholder (in UI) |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@literal` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### Hash

Returns an MD5 hash of all values as a base64 encoded string. Non-string values will be first coerced to strings. Note that order of inputs will affect the hash. –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#md5)

```sql
TO_BASE64(MD5(CONCAT(@expression)))
```

#### Return type

string

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                     | Allowed values                                                                           | Required | Placeholder (in UI) |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable)s or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)s | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### Sample

Create a random, deterministic value in the range of \[0, 1) based on a specific set of variable(s). –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#sample)

```sql
(FARM_FINGERPRINT(CONCAT(@variable)) + POW(2, 63)) / POW(2, 64)
```

#### Return type

float

#### Parameters

| Name        | Type                                                                                                                        | Allowed values                                                                           | Required | Placeholder (in UI) |
| ----------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable)s | any [Redivis type](https://docs.redivis.com/reference/datasets/variables#variable-types) | true     | -                   |

### UUID

Generate a random universally unique identifier (UUID) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#uuid)

```sql
GENERATE_UUID()
```

#### Return type

string

#### Parameters


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/reference/workflows/transforms/variable-creation-methods/other.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
