skip to main content
Input REST file syntax : Table definition entries : Subfields
  

Try DataDirect Drivers Now

Subfields

Sometimes when a value comes back as a string, only part of that string is required. The #extract property allows you to specify a regular expression that returns only a portion of the string. In addtion, using the #type property, you can map the appropriate data type for the subfield before it is converted to the local type.
A column that extracts a subfield takes the following form:
"<column_name>": {"#type":"<data_type>","#extract:<reg_expression>"}
For example, suppose you get back a color value as 27:red:#ff0000, but you only need to know that it is color 27 . You can accomplish this by specifying the following definition:
"color":{"#type":"Integer","#extract":"^([0-9]+).*"}
This results in the driver returning only the numeric portion of the string, which will be converted into an integer.