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
}
Solved! Go to Solution.
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>')
}
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>')
}
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