is it possible to make a definition query in arcgis online "map viewer"

1726
8
Jump to solution
02-07-2023 03:03 AM
PSGeo
by
Occasional Contributor

Hi.

I have a feature class with several areas some are overlapping each other. But there is a field named cities, that names each overlap with the name of the city. something like this:

Cities
Paris
London
Berlin
Paris
Paris
Rome
Berlin

 

I want to appear a polygon per city based on the their name. But on the viewer I don't even know where should I do it. I tried in the map viewer to use on the right: Styles/"My_layer"/+Expression

I tried something like this:

var AOI_name = $feature
var arr = []

for(var naming in AOI_name) {
    if(naming.name != null) {
        Push(arr, naming)
    }
}
return Distinct(arr)

 

 

any help will be fantastic.

cheers

PS

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Your English is fine! I just meant to point out that Arcade is extremely limited for what it can do in terms of symbology, and feature class filters are just basic SQL expressions, so we don't have quite as many tools in this situation.

You could do what you're describing in a Dashboard Data Expression, but sadly, not in the map viewer. There's no way to have a dynamic filter statement in the map, only a static one. So you could filter by a specific date, but not on the latest date per name.

- Josh Carlson
Kendall County GIS

View solution in original post

8 Replies
jcarlson
MVP Esteemed Contributor

The problem here is when you say "I want to appear...".

Using Arcade to generate a distinct list of features based on city names is fine, but this kind of function won't work in the symbology / display settings. If you only want a single feature per city name to actually appear in the map, you'll need some other way to filter your features.

Is it possible to add a new field to the layer, such that you could assign a row number per city, then filter based on that?

- Josh Carlson
Kendall County GIS
PSGeo
by
Occasional Contributor

Hi Josh

First of all, sorry for my English.

I cannot create another field. because the FC is being updated hourly, by a large number of people and its structure has been discussed and agreed (lot's of opinions hard to get to what we have).

Maybe, I could first filter by naming and then per name show only the latest date? Is this possible?

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Your English is fine! I just meant to point out that Arcade is extremely limited for what it can do in terms of symbology, and feature class filters are just basic SQL expressions, so we don't have quite as many tools in this situation.

You could do what you're describing in a Dashboard Data Expression, but sadly, not in the map viewer. There's no way to have a dynamic filter statement in the map, only a static one. So you could filter by a specific date, but not on the latest date per name.

- Josh Carlson
Kendall County GIS
PSGeo
by
Occasional Contributor

Sadly I will have to accept your answer as correct although it does not serve me.

Just to be sure, if I make a Dashboard out of this layer; is it possible to filter there? using the "Distinct" option?

0 Kudos
jcarlson
MVP Esteemed Contributor

Yes, you'll be able to filter it there. You can take a look at the Data Expressions GitHub repo to see some examples of how they work. It won't change how the map displays, but for things like lists, charts, etc., you can have use things like Distinct.

https://github.com/Esri/arcade-expressions/tree/master/dashboard_data

- Josh Carlson
Kendall County GIS
0 Kudos
PSGeo
by
Occasional Contributor

I am new at this... so github is something that I am not familiar with.

I should have asked with the code above would I be able to do it in the Dashboard?

 

0 Kudos
jcarlson
MVP Esteemed Contributor

It's just a bunch of example expressions. This blog post may help you get started better.

https://www.esri.com/arcgis-blog/products/ops-dashboard/announcements/introducing-data-expressions-i...

Basically, when you add an element to your Dashboard, you have the option of using an Expression to generate the layer instead of directly reading the table. This gives you the ability to apply more complex filters and calculations, which is especially useful when you can't modify the schema of the table you're working with.

- Josh Carlson
Kendall County GIS
PSGeo
by
Occasional Contributor

Hi,

really nice blog.

In fact, it gave me the idea of instead of hiding the repeated cities I could share how many times they are covered. I will try to use the "2.Working with raw data" example! Summarizing something like:

City, how many times is covered, last time has been requested (green closer dates and red older dates). Well a work for half a year! 😄

I will try

cheers for the support

 

0 Kudos