gre.get data

    [, key2, ...]

Gets one or more values from the data manager. Each argument to the function is interpreted as a data manager key whose value should be extracted from the data manager. This function returns a table using all the values as indexes and the corresponding value is the data returned from the data manager. A nil is returned for any values that do not match a key in the data manager.

Parameters: key The key whose value should be extracted from the data manager. Returns: A table containing the passed in arguments as keys and the resulting data manager values as the values associated with those keys. Example - Accessing Control Variables:

function get_data_func( mapargs )
    --When accessing control variables, use the following qualified
    --model path Layer.Control.Variable
    local data_table = gre.get_data("my_layer.my_control.variable_name")
    local value = data_table["my_layer.my_control.variable_name"]
    print("control_variable_name = " .. tostring(value))

Example - Accessing Control Width (Internal Variable):

function get_control_width( mapargs )
    --This will extract the width (grd_width) of the control
    --'my_control' on the layer 'my_layer'
    local data = gre.get_data("my_layer.my_control.grd_width")
    local value = data["my_layer.my_control.grd_width"]
    print("The width of the control is " .. tostring(value))
Was this article helpful?
0 out of 0 found this helpful