Arcade Expression in Pop-Up Error:15

2850
13
01-15-2021 02:06 PM
DanielWalsh
New Contributor II

Hello, 

We were very happy to see that Arcade expressions are supported in Field Maps and were hoping to use it to generate unique IDs in the field that can be referenced on reports, project documents. We developed an Arcade expression that does this and it works when loaded into the Beta Map viewer. However when opened in Field Maps we get an error code 15, Evaluation_error_code::unknown_function Line :20. I got the expression to work in Field Maps by removing many of the functions which unfortunately make it no longer meet our needs. Does anyone know if there is only a subset of the Arcade library that will work in Field Maps?

Thanks in advance for any help!

Below is the expression that has been developed:

var choices = {}; 
choices['1'] = 'BLD'; 
choices['2'] = 'STR'; 
choices['3'] = 'PAD'; 
choices['4'] = 'PIT'; 
choices['99'] = 'OTH'; 

function formatMulti(inField, d) {
    var values = Split(inField, ',');
    var labels = [];
    for (var i in values){
        labels[i] = d[values[i]];
    }
    var outText = Concatenate(labels, TextFormatting.NewLine);
    return outText;
}
var park = IIf(IsEmpty($feature.SiteID), "UNK", Right(Left($feature.SiteID, 6), 3));
var yr = Text($feature.CreationDate, 'YY');
var tpe = formatMulti($feature.Type, choices);
var unique_val = $feature.Creator + $feature.CreationDate;
var hashed = Round(Sqrt(Hash(unique_val)), 0);
var new_id = park + "-" + yr + "-" + tpe+hashed;

return new_id

 

Tags (2)
13 Replies
ChrisDunn1
Esri Contributor

Hi Daniel,

It looks like the Hash function is what is tripping it up, it is not currently supported by the Runtime SDK as it was introduced in Arcade 1.12. It is supported by the Runtime version 100.10, The current release of Field Maps is at 100.8 of the Runtime SDK, but the next release should be on 100.10 so your code should work then. I hope that helps

Chris

KaraUtter
Occasional Contributor III

Hi @DanielWalsh and @ChrisDunn1 - you say pop-up in the title of your submission but then you describe generating unique ID's - are you actually generating ID's in the attribute table as permanent data types through this method with Field Apps? I can't figure out how to get the pop-up information that is expressed through arcade configured in the pop-ups to pass into the Field Apps form to become actual data in the attribute table. Are you doing this?

0 Kudos
DanielWalsh
New Contributor II

Hi @KaraUtter, For me we are using the expression to display an ID for field staff to be able to add to their handwritten notes which they use when writing reports. Then once data is synced we have a tool run to write the expression to the dataset. I think field calculation in the app is coming soon though which will be a big help!

0 Kudos
KaraUtter
Occasional Contributor III
@DanielWalsh thank you for your response. I was afraid of that. I do hope field calculations with arcade expressions happens sooner than later but I bet it will be after our 2021 field season is already complete.
0 Kudos