Select to view content in your preferred language

Using Filter Widget in Experience Builder to select the minimum value of a field

547
5
Jump to solution
10-09-2024 01:23 PM
user74562
Occasional Contributor

I am using a filter widget in experience builder that I want to automatically select the minimum value of an attribute field (for the sake of this post, let's say it's OBJECTID). The reason for this being that as the feature layer in the map updates, the filter widget will reduce what's visible on the map in experience builder to whichever row has the lowest OBJECTID value. 

I could write this in SQL easy enough, the problem I'm encountering is that SQL Expressions for filtering can only be constructed in the SQL Expression Builder, which does not enable filtering by minimum / maximum values. Interestingly, I can see the SQL code underneath the SQL Expression Builder after making other filters, but cannot edit it. 

Is there a way to edit this code, and if not, does anyone have any recommendations on how to use the filter widget to select the minimum OBJECTID value in a feature layer? Thank you for any advice. 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
AlixVezina
Esri Regular Contributor

A workaround could be the following:

  1. Create a Data View for the feature layer.
  2. When you configure the Data View, Sort using the field with your values (e.g., ObjectID), and choose to Sort ascending or Descending. In the case of ObjectID, Ascending would give you the smallest values listed first.
  3. Under Records, set the Maximum record count to 1. So now, you'll always only have one record in this data view, and it will always be the record with the smallest value.
    AlixVezina_1-1728509852467.png
  4. Then you can use this Data view in a widget, like the List widget for example, and setup an action to filter all the data records when you select the feature in the List (remember, you'll only have the one feature with the smallest value listed). The fun thing is, you can write any text in the List widget and use it as a filter widget thanks to the actions.
    AlixVezina_3-1728509991096.png AlixVezina_2-1728509971867.png

     

View solution in original post

5 Replies
ZachBodenner
MVP Regular Contributor

At this time you cannot write/edit the SQL in the filter widget, though it has been suggested already as an idea, so I definitely recommend going over and giving it a kudo because it would be really useful!

Happy mapping,
- Zach
0 Kudos
AlixVezina
Esri Regular Contributor

A workaround could be the following:

  1. Create a Data View for the feature layer.
  2. When you configure the Data View, Sort using the field with your values (e.g., ObjectID), and choose to Sort ascending or Descending. In the case of ObjectID, Ascending would give you the smallest values listed first.
  3. Under Records, set the Maximum record count to 1. So now, you'll always only have one record in this data view, and it will always be the record with the smallest value.
    AlixVezina_1-1728509852467.png
  4. Then you can use this Data view in a widget, like the List widget for example, and setup an action to filter all the data records when you select the feature in the List (remember, you'll only have the one feature with the smallest value listed). The fun thing is, you can write any text in the List widget and use it as a filter widget thanks to the actions.
    AlixVezina_3-1728509991096.png AlixVezina_2-1728509971867.png

     

KatyShea
New Contributor

Great workaround!  Thanks for sharing and instructing.  I've used data views similarly to make workaround text indicators numbers and feature boxes.  I miss Dashboard indicators!

user74562
Occasional Contributor

Hello AlixVezina, thank you for this workaround, it looks very promising and it seems other users are using it successfully. I am stuck on Step 3 and was wondering if you would mind elaborating. I do not see an option for Records when creating a Data View like in your screenshot.  

Right now I have the Feature Layer open in the Overview page on AGOL. I click "Create View Layer" > View Layer

screenshot1.png

I'm able to sort ObjectID by ascending, but do not see an option titled Records that enables me to reduce maximum record count to 1, as is shown in your sceenshot. Could you please elaborate on the steps taken to navigate to the Records options?

0 Kudos
AlixVezina
Esri Regular Contributor

Hi @user74562 , I was referring to a Data View in Experience Builder rather than a Feature Layer view. Here's a tutorial from Esri Canada on Data views: Create Data Views in ArcGIS Experience Builder