Subfields
- Last Updated: April 17, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
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.