ICAST
  • 1 Minute to read
  • Dark
    Light
  • PDF

ICAST

  • Dark
    Light
  • PDF

Article summary

String: ICAST

Extract numeric data contained in a string and store as a numeric integer

Converts a DISCRETE or CONTINUOUS STRING field into an INTEGER field. The string must be an exact integer or it will be cast as NULL.

Purpose

Use this function to:
  • Force a string to be numeric
  • Filter records containing non-numeric data

Return Value

PropertyValue
FieldTypeInteger
FieldSizeLow / Med / High / Continuous
DataTypeDiscrete / Continuous
DataSizeShort / Integer / LongInteger / Double
Example Return Value: 321565


Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter recordset will be returned as null.
Function
"function":""
String
String Function“p1”: “ICAST(A)”ICAST(A)
A“p2”:Required. The source field from which to extract the numeric data. 
Supports:  
  • DataType: Discrete / Continuous
  • Field Type: String 
  • Fixed Value: "NNaANNuu"
Treat Null as Zero"nullIsZero": true
"nullIsZero": false

True/False.
Default = False
If true, then any null values in the input fields will be treated as if they have a value of 0.

JSON Sample

{
  "method": "BuildBakedField",
  "project": "BikeData2",
  "targetTable": "Journeys",
  "overwrite": true,
  "name": "start_station_id_only",
  "function": "string",
  "p1": "ICAST(A)",
  "p2": "start_station_raw"
}


Usage Notes

See Also:   

  • Engineering | Expression Field

Example

ExampleDetails
DescriptionExtract Numeric fields from a mixed string
Input
  • Table: = [journeys]
  • Filter: = [No Filter]
  • Function: = String
  • String Function:= ICAST(A)
  • A:=[journeys].[start_station_raw]
  • Name: = start_station_id_only
Sample





Was this article helpful?

What's Next