Select to view content in your preferred language

Show all features from one layerin a single spot in pop up

362
3
Jump to solution
03-23-2026 07:45 AM
Labels (2)
Norquest
New Contributor

I saw some previous posts of people trying to do this and I figured out a way. You must be in a version of portal that has $userInput available.

I wanted to show a list of all features from a single layer in a single spot when you click on that spot. I have a layer of utilities engineering As Builts that overlap, three or four can cover a single intersection and I want users to have the choice to open any one of them when they click on an intersection. 

I know users can "scroll" through features on a pop up but i wanted them all on a single pop up.

One of my fields is a URL field and this turns a field name into a hyperlinked URL

I would like help making the display either a table or bullet points. 

they currently come through like:

Name 1975 Name 2003 Name 1982

 

also, "AsBuilt_Name" doesn't pull through

 

EDIT: Html "<br/>" breaks it into a new line, still could use some customization

 

var AB = FeatureSetByName($map, 'As Built Polygons')

var ABpoly = Intersects(AB, $userInput)

// uses the intersect of the click//

var result = ' '

for (var poly in ABpoly){
  var link = poly.AsBuilt_Link
  var name = poly.Laser_fiche_name
  var yr = poly.year
  var nm = poly.AsBuilt_Name

  result +=  nm + "   <a href =" + link + ">" + name +  "</a>" +"  " + yr +  TextFormatting.NewLine
}

//pulls the fields from the layer and builds a url using the field name//

return {
  type: 'text', 
  text : result
  } 

 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Here's a way to create a bulleted list.

In each loop, the string is pushed into the result array. The string also use a template literal. The Concatenate function creates a string from that array, separating the array items by a line break.

As for the AsBuilt_Name not coming through, have you checked using a console in your loop whether there's an attribute in that field?

var AB = FeatureSetByName($map, 'As Built Polygons')

var ABpoly = Intersects(AB, $userInput)

// uses the intersect of the click//

var result = []

for (var poly in ABpoly){
  var link = poly.AsBuilt_Link
  var name = poly.Laser_fiche_name
  var yr = poly.year
  var nm = poly.AsBuilt_Name
  console(nm)
  Push(result, `• ${nm}   <a href =${link}>${name}</a>  ${yr}`)
}

//pulls the fields from the layer and builds a url using the field name//

return {
  type: 'text', 
  text : Concatenate(result, '<br>')
  } 

 

View solution in original post

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

Here's a way to create a bulleted list.

In each loop, the string is pushed into the result array. The string also use a template literal. The Concatenate function creates a string from that array, separating the array items by a line break.

As for the AsBuilt_Name not coming through, have you checked using a console in your loop whether there's an attribute in that field?

var AB = FeatureSetByName($map, 'As Built Polygons')

var ABpoly = Intersects(AB, $userInput)

// uses the intersect of the click//

var result = []

for (var poly in ABpoly){
  var link = poly.AsBuilt_Link
  var name = poly.Laser_fiche_name
  var yr = poly.year
  var nm = poly.AsBuilt_Name
  console(nm)
  Push(result, `• ${nm}   <a href =${link}>${name}</a>  ${yr}`)
}

//pulls the fields from the layer and builds a url using the field name//

return {
  type: 'text', 
  text : Concatenate(result, '<br>')
  } 

 

0 Kudos
Norquest
New Contributor

Thanks for the quick response! This added the bullet points with an indent. 

The "AsBuilt_Name" field is empty in some cases and that was the issue.

and idea how to make the font bigger on these rows?

Thank you so much

0 Kudos
KenBuja
MVP Esteemed Contributor

There are several ways to do that. You can use html tags in the string. You can also use css.

`• <font size="3">${nm}   <a href =${link}>${name}</a>  ${yr}</font>`