A set of functions for working with voxels.
DefaultValue
DefaultValue(inputVoxel, fieldName, defaultValue) -> Any
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 default
.
Example
Return "n/a" if voxel attribute does not exist or is empty
DefaultValue($voxel, "sea_temp", "n/a")
// Returns the sea_temp value if available
// or n/a if not available
HasKey
HasKey(inputVoxel, key) -> Boolean
Function bundle: Core
Indicates whether a voxel has the input key.
Parameters
Return value: Boolean
Example
Returns true
if the voxel has a field named sea
HasKey($voxel, 'sea_temp');
HasValue
HasValue(inputVoxel, fieldName) -> Boolean
Function bundle: Core
Indicates whether a voxel has a given field and if that field has a value.
Parameters
Return value: Boolean
Example
Return false if voxel attribute does not exist or is empty
iif(HasValue($voxel, "sea_temp"), ($voxel.sea_temp - 32) * 5/9, false)
// Returns the temp in celsius if sea_temp is available