Select to view content in your preferred language

Can't return Null when using Attribute Rule (edit/Update) and arcade

1651
5
02-06-2020 03:01 PM
TL2
by
Frequent Contributor

While Null now works in arcade field calculations on Pro 2.5, it still does not work in Attribute Rules while using the edit keyword and update.

Attribute rule dictionary keywords—Geodatabases | Documentation 

return {
    "result": $feature.assetid,
    "edit": [{
        "className": "electricdistributionassembly",
        "updates": [{
            "objectID": feature_objectid,
            "associationType": Null
        }]
    }]
}‍‍‍‍‍‍‍‍‍‍

The above code will not work.  It returns a what I am guessing is an empty field.  It does not work on strings or dates.

I need a simple attribute rule that updates a field to "Something" on insert/update and to <Null> on insert/update on "Something Else"

My code works except that there is no way to return Null using Attribute Rules & Arcade.  You can return a string, date or 0 (in the case of dates 12/30/1899).

I have set to Null and tried to set it to a field that is Null.

0 Kudos
5 Replies
KeithKatashuk
Emerging Contributor

I am having the exact same problem and came on here to check.

I basically want to have a safety mechanism set to where the field users are protected from accidentally typing in the wrong date field in Collector, since we have multiple date fields.

I'm getting the same weird date of 12/30/1899 as well. Here is how my attribute rule is set

Have you heard anything on this yet?

0 Kudos
TL2
by
Frequent Contributor

I am actually trying to edit a different feature class using "Edit", which still does not work.

What you are doing does work:

{
return Null;
}

KeithKatashuk
Emerging Contributor

Yep, that did the trick. Thanks for the help!

0 Kudos
RalfSchmidt
Occasional Contributor

I have the very same problem, i.e. returning an "edit" dictionary with null values does not work because null is converted to 0

0 Kudos
Bud
by
Esteemed Contributor
0 Kudos