EQuIS Link Variables Attribute

<< Click to Display Table of Contents >>

Navigation:  EDP > EQuIS Link > Data Mapping >

EQuIS Link Variables Attribute

Variables is a data mapping attribute at the table level. The variables attribute is usefully when numerous data mappings with similar structures are required.

 

The variables attribute feature allows users to specify variable replacements in their mappings using JSON (JavaScript Object Notation) arrays and objects. Each JSON object is a set of key/value pairs. When the variable attribute is set, the mapper will iterate over each of the JSON objects in the attribute and replace each of the fields specified by the keys of the JSON object with the corresponding value.

 

Note: Any valid formula expression can be used as a value, but only existing field names can be used as keys.

 

Read these articles to learn more about JSON arrays (https://www.w3schools.com/js/js_json_arrays.asp) and JSON Objects (https://www.w3schools.com/js/js_json_objects.asp).

 

 

Example

 

A user wants to import "Surface RL" and "Water RL" as location parameters into the LocationParameter_v1 tables of the EQEDD Format. The source data file contains sheets with the following columns: Date/Time, Borehole, Surface RL, and Water RL. For each row of data in the source file, two parameters rows need to be generated with the data mapping. This example is extremely simplistic with only two parameters for illustrative purposes. The power of the variables attribute feature is realized when numerous data mappings with similar structures are required.

 

Two options exist to create the necessary data mappings in EQuIS Link:

1.Copy Remap Field – Create the data mapping for one of the location parameters (Surface RL) and then use the “Copy Remap Field” option to generate the second data mapping (replacing a constant and field for another constant and field). The Water RL parameter data mapping would be identical to the Surface RL mapping, but replacing "Surface RL" with "Water RL" as well as the corresponding field names. Note that the parameter code is hard coded to the parameter name and the parameter value is set to the corresponding field for that parameter value.

EDP_Link-Remap_Example1

EDP_Link-Remap_Example2

2.Variables Attribute – The data mapping can be completed as a single mapping using the variables attribute option. Instead of creating the data mapping with a specific parameter code and parameter value, two “variable fields” can be used with any desired name. In this case, the variable fields are called [X] and [Y]. Since the fields "X" and "Y" do not exist in the data source, this data mapping would be ignored unless these fields are referenced in the Variables attribute and replaced with valid values.

 

Note: The PARAM_CODE and PARAM_VALUE were arbitrarily chosen as [X] and [Y] and can be assigned any value but need to match the values in the Variables array string.

 

EDP_Link-Variable_Attribute_Example2

Although the replacements can be any valid formula expression, for this example, field [X] will be replaced with a constant string representing the parameter code and field [Y] will be replaced with the name of the field that contains the value for that code. The formula that generates the corresponding JSON array with the two objects is:

'[{"X":"''Water RL''","Y":"[Water RL]"},{"X":"''Surface RL''","Y":"[Surface RL]"}]'

 

Note: The constant string values for the Variables are enclosed in Two Single Quotes (‘’) inside Double Quotes (“) as required for the JSON. Fields are in brackets ([ ]) inside Double Quotes (“).

 

The single data mapping that uses fields X and Y and has the above formula as the Variables attribute will produce the same results as creating two data mappings with no variables attribute (Option 1 in this example). The main difference is that the variables attribute can be generated by a formula based on data, and the values it replaces for fields can also be generated based on data, making it an extremely powerful but complex feature.