Attribute Rules - Updated multiple attribute fields on same feature on the same feature row with one calcualtion rule

Idea created by ddp999 on Jun 26, 2020
    Reviewed
    Score30
    • marc.wilkes
    • ddp999
    • jborgion

    On calculation insert and update rules, allow multiple attribute columns to be updated on the same feature / row.  Currently rule hangs in a recursive loop.

    If you wanted to update 6... fields on the same feature on insert / update you must create 6... rules one for each field.  This idea would allow for one rule to update multiple fields and create better performance when updating or inserting many rows

     

    Ex: Both return value and update values are to the same feature and row. This hangs recursion

    var currFromMeasure = $feature.FROM_MEASURE;

    var currToMeasure = $feature.TO_MEASURE;

    var fromMeasure = Geometry($feature)['paths'][0][0]['m'];

    var toMeasure = Geometry($feature)['paths'][-1][-1]['m'];

    var calFromMeasure = null;

    var calToMeasure = null;

      

    if (IsNan(fromMeasure) || IsEmpty(fromMeasure)) {

    calFromMeasure = currFromMeasure;

    }

    else {

    calFromMeasure = fromMeasure;

    }

      

    if (IsNan(toMeasure) || IsEmpty(toMeasure)) {

    calToMeasure = currToMeasure;

    }

    else {

    calToMeasure = calToMeasure;

    }

      

    return {

    'result':calFromMeasure,

    'edit':[

    {

    'classname': 'PODS.CLASS_LOCATION',

    'updates':[

    {

    'GLOBALID': $feature.GLOBALID,

    'attributes': {

    'TO_MEASURE' : calToMeasure

    }

    }

    ]

    }

    ]

    }