Support
Exchange Support Functions for Expressions
Support Functions
dms2deg
Accepts a string in the dms format (e.g., "S33.50'23.85") and returns the equivalent degrees value (i.e., 33 + (50/60) + 23.85/3600 = -33.8399583333).
Example
<field name="georef_x"> <expression>dms2deg( $x_coordinate )</expression> </field>
lookupId
lookupId is used within the context of an expression tag. It takes three arguments:
- $value - the value to search for
- $lookupTable - the name of the table to look in
- $lookupField - the name of the field to loop up the value
- $conditions - an optional named array (field => value) for additional where conditions
The method returns the value of the ID column.
Examples
To use a reference field to replace existing values or insert new ones. In the following example we assume we are uploading from a csv with a reference key.
<field name="id">
<expression>lookupId( $reference_key, 'jxcatalog_nodes', 'reference'
[, array( 'field' => 'value' );</expression>
</field>
makeAlias
makeAlias is used to convert text to an alias compatible format. It takes three arguments:
- $text - the text to convert to an alias
The method returns the text with spaces converted to dash (multiple spaces are concatenated into one dash), ampersands are converted to "and" and all non-alphanumeric characters (excluding dash and underscore) are removed.
Examples
This example processes a variable called "name" (either that is the field name from another table, or is the column name in a CSV file).
<field name="alias"> <expression>makeAlias( $name )</expression> </field>
0 Comments