Zum Hauptinhalt gehen

How to use Arcade Expressions

Kommentare

13 Kommentare

  • Permanently deleted user
    You probably figured this out already, but did you create a token (name) for the expression and then use the token in your Feature Details (not the expression itself)? So the token would be something like "Email" on the expressions tab, and then in your feature details you would insert {Email} where you wanted it to go. I figured out my expression with the help of your post ($feature.fieldname) so I thought our two posts might help someone else!
    0
  • John Nerge
    Thanks Heather, I had specified a token, but I still appreciate the help. The Arcade piece is working, it seems like the issue is with the <a> tag not working properly with it.

     

     

    Denise, try this code out:

     

     

    var cities = FeatureSetByName($map,"Multi Tenant Buildings")

     

    var intersectLayer =Intersects(cities, $feature)

     

     

    //Loop through the intersect layer to see if the feature intersect any records in the city limits layer

     

    for (var f in intersectLayer){ var message = 1 }

     

     

    //If an intersecting record was found, return the name, if not, return "Kern County"

     

    iif(message==1,$feature.Name,"Kern County")
    0
  • John Nerge
    Oops, missed a value for you, here's the right code:

     

     

    var cities = FeatureSetByName($map,"City Limits")

     

    var intersectLayer =Intersects(cities, $feature)

     

     

    //Loop through the intersect layer to see if the feature intersect any records in the city limits layer

     

    for (var f in intersectLayer){ var message = 1 }

     

     

    //If an intersecting record was found, return the name, if not, return "Kern County"

     

    iif(message==1,$feature.Name,"Kern County")
    0
  • Denise Beckham
    Thank you, John!  Unfortunately, that didn't seem to do the trick.  Does it matter that the city limits are in a different map service than the point layer (the point layer is actually a feature layer)?  Also, it shouldn't matter if the city limits are on or off, correct?

     

     

    Thanks,

     

    Denise
    0
  • John Nerge
    It shouldn't matter that the city limits are in a different map service or are on/off. For the feature layer question, I'm not sure. As a next step, I'd recommend bringing your city limits and points into an ArcGIS Online map and trying to set up the Arcade in the point's pop-up. AGO has error messaging, so when you test the code it should hopefully give you some more info.
    0
  • Denise Beckham
    I got this message when I tried it in AGOL: 

     

    Execution Error:Runtime Error: Identifier Not Found. message
    0
  • John Nerge
    Okay, so less than helpful.

     

     

    Try running just these two lines in AGO on your point layer:

     

    var cities = FeatureSetByName($map,"City Limits")

     

    Intersects(cities, $feature)

     

     

    Make sure your city limits layer is called City Limits (or update the Arcade code to match what it's called).

     

     

    If it works, you'll get back either a result of False or a feature set table showing the values from an intersecting City Limits feature.
    0
  • Denise Beckham
    Thanks, John. The layer is definitely called "City Limits".  I got back a result of False.
    0
  • John Nerge
    Hmm, a little concerned, but at least it's not an error? Here's some new code to try. It'll run the intersect, then count the number of intersecting features. If there aren't any it'll return your default "Kern County" value, but if it does then it'll return the city  name from the City Limits layer.

     

     

    var cities = FeatureSetByName($map,"City Limits")

     

    var intersectLayer = Intersects(cities, $feature)

     

     

    if (count(intersectLayer) == 0) {

     

    return "Kern County"

     

    }

     

     

    else {

     

        for (var f in intersectLayer){

     

            var city = f.Name

     

        }

     

        return city

     

    }
    0
  • Denise Beckham
    Hmm, now it's giving me this error: 

     

    Execution Error:Invalid Parameters for Count
    0
  • John Nerge
    Any chance your map layers are publicly accessible? If not, we could take this offline and set up a screen share (john.nerge@brooklynpark.org)
    0
  • Richard Diaz
    Instead of using FeatureSetByName, try FeatureSetById($map,'10') with in this case '10' being the Geocortex layerid in the map,

     

     

    Have a look at the Arcade syntax in the LA County sample site > Base Layers > Administrative Areas > Community Boundaries > TOPTREES Arcade expression using Intersects.

     

     

    Cheers...Rick
    0
  • Richard Diaz
    BTW, there are other Arcade expressions in this layers: 

     

     

    LA County sample site > Base Layers > Administrative Areas > Health Districts

     

    LA County sample site > Base Layers > Administrative Areas > Census Tracts
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.