Select to view content in your preferred language

Dashboards That Pop: URL Parameters

916
2
12-03-2024 10:49 AM
JenniferAcunto
Esri Regular Contributor
2 2 916

What Are They ?

URL Parameters are a handy way of providing different views of your dashboard without having to create and manage multiple dashboards. URL parameters can: 

  • Filter based on your data or map extent 
  • Flash a record or point 
  • Zoom to a record, specified point, or map extent 
  • Show a record’s pop-up 
  • Pan to a feature, point, or map extent 

The capabilities differ depending on the type of parameter. You can read more about the different parameter types and their capabilities here. 

It’s important to note that these parameters are for convenience and do not actually secure data from the users. If they remove the parameters in the URL, they can see all of the data. If they find the underlying map or data layer that powers the dashboard, they can see all of the data. If data security is an important requirement, do not use URL parameters.  

Say I have this Parking Dashboard with a normal dashboard URL (hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf). By default, it displays several different zones.  

Parking dashboard covering various zones.Parking dashboard covering various zones.

 

I might have different teams for each zone, and while they can easily filter the dashboard for their zone, they don’t want to. They want a dashboard that just opens to their zone automatically. Instead of having to make multiple versions of the same dashboard, I can instead set up a URL parameter to filter the zones and give each team their own unique link. 

This link will open displaying only Downtown: hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1=Downtown 

Parking dashboard displaying the Downtown zone.Parking dashboard displaying the Downtown zone.

 

And this link will open City and Mid-City zones: hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1= City,Mid-City 

Parking dashboard displaying City and Mid-City zones.Parking dashboard displaying City and Mid-City zones.

 

💡I’ve shamelessly stolen this dashboard from the ArcGIS Dashboards Product Team and you can too! It’s a great way to pick up some neat Arcade and HTML snippets.  

 

URL Parameter Set-Up 

In the View panel, click on the Settings tab. 

Click the Edit button next to URL parameters. 

Dashboard View PanelDashboard View Panel

 

Click on the + Add URL parameter button and select the parameter type you want to add. 

Add URL Parameter ButtonAdd URL Parameter Button

 

You can use the default parameter name or set your own. I typically just use the default unless I am adding quite a few and then I will set the name, so it is easier to remember which is which. The name is used in the URL so be sure to name it something short and to the point.  

Parameter NameParameter Name

 

The remaining configuration options available to you will depend on the parameter type, but the basic steps are just like setting up Dashboard Actions. 

URL Parameter ConfigurationURL Parameter Configuration

 

Once you are done configuring your parameters be sure to save your dashboard.  

 

Creating the URL 

Start with your normal dashboard URL. 

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf 

Add a pound sign (hashtag) to the end to signify the start of the parameters. 

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf# 

Next add the parameter name and an equal sign. 

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1= 

Then add the value. This should match what you have in the data. If you are using a field with a domain, use the name or code as opposed to the label. 

 hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1=Downtown 

If your value has spaces or special characters in it, you must encode it. Do not encode the entire URL, ONLY encode the specific value.  

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1= Bankers%20Hill 

You can use this handy encoder for reference. 

URL Encoder ToolURL Encoder Tool

 

You can add multiple values to a single parameter by adding a comma between them. Do not encode the comma. 

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1=Downtown,Uptown 

Use an ampersand to add additional parameters. 

hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1=Downtown,Uptown&meter=260 

 

Dynamic URLs 

You can set up dynamic URLs that are automatically created for you using pop-ups or a list. I’ll use a dashboard list element, but the basic approach works in pop-ups and other apps.  

I have this default dashboard that displays volcanoes.  

Global Volcano DashboardGlobal Volcano Dashboard

 

I am going to add a hyperlink to this dashboard in a separate dashboard list item that will use dynamic URL parameters to open this dashboard focused on the specific volcano the user selected in the list. 

List to Filtered DashboardList to Filtered Dashboard

 

Method 1 

This is the most straightforward method, but it only works if you do not need to encode any of your parameter values.  

Simply copy and paste your dashboard URL (with parameters but not the parameter values) into the rich text editor.  

Then use the field picker to add the field that is used as the URL parameter value to the end of your URL.  

Now we have the constructed URL that is unique to each list row, but it is ugly. Time to turn it into a hyperlink.

Add your hyperlink text to the rich text editor.  

Highlight the link you just created and cut it. 

Highlight your hyperlink text and click on the Link button.  

Paste the cut URL into the Link URL box.  

 

Link Creation to HyperlinkLink Creation to Hyperlink

 

Method 2 

This method uses Arcade to encode the parameter values.  

Enable Advanced formatting. 

Create a variable and assign your dashboard URL (with parameters but not the parameter values) to it. 

Create a new variable that uses the UrlEncode() function with the field that is your parameter value. 

Create a third variable that combines the two together. Return this variable as an attribute. 

 

//Create a variable for your base url

var baseurl = 'hxxps://sampleorg/apps/dashboards/12d1b1dbee3d44eab40e441164f356bf#p1='


//Create a variable for your parameter value field and encode it

var val = UrlEncode($datapoint.Volcano_Name)


//Create a variable and combine the previous two varaibles

var url = Concatenate(baseurl + val)


return {

 textColor: '',

 backgroundColor: '',

 separatorColor:'',

 selectionColor: '',

 selectionTextColor: '',

 attributes: {

  url: url

}

}

 

 

Use the field picker to add the expression to the rich text editor and then just like in Method 1, paste it into the hyperlink Link URL box. 

 

Arcade Link to HyperlinkArcade Link to Hyperlink

 

 

Happy Dashboarding! 

Dashboards That Pop Series 

 

2 Comments
Contributors
About the Author
I'm a Technical Consultant that focuses on app configuration with a little Geospatial Strategy and Governance thrown in.