Voxel functions

A set of functions for working with voxels.


DefaultValue

DefaultValue(inputVoxel, fieldName, defaultValue) -> Any

Since version 1.30

Function bundle: Core

Returns a specified default value if a field name in a voxel does not exist or the value of the specified field is null or an empty text value.

Parameters

  • inputVoxel: Voxel - The input voxel to check.
  • fieldName: Text - The field name to check.
  • defaultValue: Any - This value is returned if the field name does not exist or the value of the specified field is null or an empty text value.

Return value: Any
Returns the value for the specified field if defined. Otherwise, returns the value specified in defaultValue.

Example

Return "n/a" if voxel attribute does not exist or is empty

Use dark colors for code blocksCopy
1
2
3
DefaultValue($voxel, "sea_temp", "n/a")
// Returns the sea_temp value if available
// or n/a if not available

HasKey

HasKey(inputVoxel, key) -> Boolean

Since version 1.30

Function bundle: Core

Indicates whether a voxel has the input key.

Parameters

  • inputVoxel: Voxel - The voxel to check for a field name.
  • key: Text - The field name to check.

Return value: Boolean

Example

Returns true if the voxel has a field named sea_temp

Use dark colors for code blocksCopy
1
HasKey($voxel, 'sea_temp');

HasValue

HasValue(inputVoxel, fieldName) -> Boolean

Since version 1.30

Function bundle: Core

Indicates whether a voxel has a given field and if that field has a value.

Parameters

  • inputVoxel: Voxel - The voxel to check.
  • fieldName: Text - The field name to check.

Return value: Boolean

Example

Return false if voxel attribute does not exist or is empty

Use dark colors for code blocksCopy
1
2
iif(HasValue($voxel, "sea_temp"), ($voxel.sea_temp - 32) * 5/9, false)
// Returns the temp in celsius if sea_temp is available

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.