Global Arcade functions

332
1
11-23-2023 12:36 AM
Status: Open
Labels (1)
Bud
by
Notable Contributor

It would be great if we could create a global Arcade function in a geodatabase, and then use the function in multiple places, without needing to re-write the code.

For example, create a global function called isBlankShape where you pass in a shape value and the function checks to see if the shape is blank or not (null shape, nil geometry, or null geometry). I’d then create validation attribute rules on all feature classes in the geodatabase. The rules would call the global function: if the result of the function call is false, then allow the edit. If the result is true, then don't allow the edit. 

That kind of thing is easy at the enterprise database level: create a custom function and triggers using PL/SQL. But as a novice, it doesn't seem to be possible with Arcade.

Related: Global Arcade function for use in multiple attribute rules

1 Comment
Bud
by

Another use case is a function that checks non-spatial fields for incorrect blank values:

  • '<null>' or 'null' instead of a true null (account for lowercase vs uppercase)
  • ' ' (space) or '  ' (double space)
  • 0 (zero)
  • '0' (text)
  • '-' (hyphen/dash)
  • '' (empty string) - This doesn't apply to Oracle, since empty strings get automatically converted to null in Oracle.


I don't want to use lengthy code in attribute rules for each field in each FC for that. I only want to write the code once in a function, then call that function from attribute rules.


Related: Oracle EGDB: Find junk values in all tables and columns (and log them in a table)