Arcade Feature-Set Works but Does Not Display in Popup

1184
3
Jump to solution
03-11-2019 02:30 PM
Amanda__Huber
MVP Regular Contributor

Hi All, 

We recently constructed an Arcade expression using Feature-Sets. The arcade expression validates but does not display in the popup. It's a simple text string that should display. Even if we change the return to an arbitrary word like "test" it still does not display in the popup. Please see images below. Expression is in text form at the bottom of the post. 

Any other arcade expressions work fine in this web map and popup. 

Explanation of the expression: 

We're displaying a string of text that falls under three parameters NotesOrObservation is Observation, SpeciesType is House Wren, and DateofObservation is Current Year. Since "AND" statements don't seem to be a supported Arcade function we used the below. 

-  Feature-Set is looking at the related table in the map

-  Sorting by "DateOfObservation" date descending

-  If parameter is met "Yes" is returned

- Return is a concatenation of three parameters

      example) If all three parameters are Yes then "yesyesyes" is returned 

Arcade Expression and Result: 

Expression in popup configuration: 

Popup Blank Return: 

Expression: 

var Related= FeatureSetByName($datastore,"BlueBird_Boxes_Records")
var sort = OrderBy(Related, "DateOfObservation Desc")
var top1= Top(sort, 1)
for (var x in top1){var species = x.SpeciesType; var NoteOB = x.NotesorObservation;var DateOB = x.DateOfObservation}
var yesno = ''
iif (species == 'House Wren', yesno += 'yes', yesno +='no')
iif (NoteOB == 'Observation', yesno += 'yes', yesno +='no')
iif (Year(DateOB) == Year(Now()), yesno += 'yes', yesno +='no')

return yesno

0 Kudos
1 Solution

Accepted Solutions
Amanda__Huber
MVP Regular Contributor

Hi Russell Roberts

Thanks so much for your quick response.

It does look like switching it to an if-else instead of iif works! Do you know if there is a reason for this?

Thanks!

View solution in original post

3 Replies
RussRoberts
Esri Notable Contributor

Can you try using if-else in your expression instead of iif. 

Thanks!

Russ

Amanda__Huber
MVP Regular Contributor

Hi Russell Roberts

Thanks so much for your quick response.

It does look like switching it to an if-else instead of iif works! Do you know if there is a reason for this?

Thanks!

by Anonymous User
Not applicable

Hi @RussRoberts,

I can see that it is a bit old discussion but I have the same problem. I have written Arcade expression which validates in console and I can see a result, but the field is empty in pop-up.  

Any other arcade expressions work fine in this web map and popup.

What the script does is getting an url attribute from related table. As the relation is 1:M, I want to get all the urls and display them in separate fields. That's why I create a list and then refer to lists items.

I attach pictures and the code. I would really appreciate any help.

AZietara_0-1663704096182.png

 

AZietara_1-1663704103160.pngAZietara_2-1663704107852.png

var mygid = Text($feature.gid);
var related_table = FeatureSetByName($map, 'imagesFGB')
var filter_query = "gid  = " + mygid + " ";

var rd_filtered = Filter(related_table, filter_query);
var rdf_count = Count(rd_filtered);
var result = ""
var result1 = ""

if (rdf_count == 1) {
    for (var rd_row in rd_filtered) {
          var result = rd_row.url;
    }
}

if (rdf_count >1) {
    for (var rd_row in rd_filtered) {
          result1 += rd_row.url + ',';
    }
    var res = Split(result1,',')
    var result = res[0]
}

else  {
    var result = "ingen bilder";
}

return result

 

0 Kudos