Select to view content in your preferred language

Customizing Dynamic Text in Layout

697
10
06-11-2024 02:42 PM
LDoty
by
New Contributor II

I have a layout that displays a set of traffic accidents at a given intersection and must dynamically update the Primary Street, Secondary Street, From Date, To Date, and counts of injury severity based on the visible points in the map frame.

Layout.PNG

 I have three specific questions:

1) For Primary Street and Secondary Street, how do I display ONLY the attributes for the first row in my table?  I am currently getting a list of all distinct Primary and Secondary Streets visible in the map frame.

2) For From Date, how do I display just the oldest date?  For To Date, how do I display just the most recent date?  Again, I am currently getting a list of all distinct dates visible in the map frame.

3) For injury counts, how can I count different values from the same attribute field?  It appears I am not able to use iif() because it is only evaluating one row at a time, instead of treating all the points visible in the map frame as a table to be parsed.

The purpose of this layout is to create a custom print template in Experience Builder.  If there is a better way to go about this task as a whole, please let me know that too!

0 Kudos
10 Replies
AubriKinghorn
Esri Regular Contributor

Hi! 

This is a really cool project. I think you need different kinds of dynamic text for some of these, and lots of SQL queries, which are supported in certain dynamic text elements.

Based on the information you provided I would try

  • Primary St: Value dynamic text with a SQL query 
  • Secondary St: Value dynamic text with a SQL query 
  • Start Date: If the map is time-aware, use Start time. Otherwise you'd have to use Value and a SQL query I think
  • End Date: If the map is time-aware, use End time. Otherwise you'd have to use Value and a SQL query I think
  • Count: Count dynamic text with a SQL query for your attribute or combination of attributes

Does this help at all?

Cheers,
Aubri
0 Kudos
LDoty
by
New Contributor II
Thanks!
I think you are right about needing to use SQL queries. I'm used to seeing SQL as a language option but I'm only seeing Arcade in the Expression Builder. Would I just save it as a label expression file and import it? (I haven't done that before.) Or is there a way to add SQL to the Expression Builder language options?
[cid:image002.jpg@01DABC16.783EE0A0]
0 Kudos
AubriKinghorn
Esri Regular Contributor

I forgot to clarify, adding a SQL query is separate from the expression builder option. To access it change the Query type from all or visible to Custom query. That exposes the SQL query builder. 

AubriKinghorn_0-1718210245720.png

 

Cheers,
Aubri
0 Kudos
LDoty
by
New Contributor II

I tested the Custom Query option for the counts and, while I was able to filter on the value I needed, it applied the filter to the entire table and not just to the points in the map frame.  Any suggestions on how to exclude the values not shown using the SQL query?

0 Kudos
AubriKinghorn
Esri Regular Contributor

Dang it, I forgot you needed only the visible to show up. There isn't currently a way to combine visibility and a SQL query. However, you are working with this for a print template right? There might be some additional things you can do in your custom print template code to make it work. Perhaps @TanuHoque can provide some ideas. 

Cheers,
Aubri
0 Kudos
TanuHoque
Esri Regular Contributor

@LDoty 

Unfortunately ExB print widget doesn't support dynamic text elements at this point. Until they support this, please check out the below post, and you might find it helpful generate output from your print service with dynamic text element

https://community.esri.com/t5/arcgis-enterprise-documents/print-dynamic-text-from-a-web-application/... 

0 Kudos
LDoty
by
New Contributor II
Hi @TanuHoque. This is actually what I am trying to create at the moment, a layout with dynamic text in Pro to be exported. That is where I'm getting stuck. I'm trying to get the dynamic text to display specific information from the visible data only. The SQL queries I created are looking at the whole table. Any thoughts on a good way to tackle that?
0 Kudos
TanuHoque
Esri Regular Contributor

hi @LDoty 

does it work with from print service side with some simple dynamic text elements for you?

0 Kudos
LDoty
by
New Contributor II
I haven't tried the print service side, yet. I've been focused on creating the layout in Pro with the dynamic content I need, first.
0 Kudos