Select to view content in your preferred language

AGOL layer's popup not displaying in Pro

413
1
Jump to solution
08-03-2023 09:58 AM
Labels (3)
davedoesgis
Occasional Contributor III

I have a complex popup that I created in an AGOL hosted feature layer. When I add the AGOL layer to Pro, the title is correct, but the popup display is just blank!

dcafdg_0-1691081050761.png

Here is what it looks like in the Visualize tab of my AGOL hosted feature layer. It has a custom title and a single Arcade expression that produces the HTML for the display.

dcafdg_1-1691081277714.png

In my tests, I was able to get an HTML-based popup from an AGOL layer working when added to Pro, so I know it is possible.

dcafdg_2-1691081439270.png

Since nothing displays, I have no idea where to start. How do I go about troubleshooting this? Can I get the Console() function to print somewhere in Pro? Are there specific limitations in Pro that don't exist in AGOL (e.g.: adding images from an external web site)?

 

1 Solution

Accepted Solutions
davedoesgis
Occasional Contributor III

It looks like the culprit is a difference in how the language works in AGOL popups vs. in Pro. I thought the whole point of Arcade was that it runs the same everywhere!!!

In short, AGOL Arcade functions support optional arguments. If I omit a function argument in AGOL, the variable will be null. I can test for it with the IsEmpty() function. For example, this simple function will print out a field value (argument 1), but if the field value is null or empty, then it will spit out a placeholder message (argument 2) in a different color (argument 3).

function textPlaceholder(input, placeholder, color) {
	if (!IsEmpty(input)) return input;
	if (IsEmpty(placeholder)) placeholder = '[n/a]'
	if (IsEmpty(color)) color = colors_faded;
	return `<span style="color: ${color};">${placeholder}</span>`
}

If I call this on AGOL, I can omit arguments 2 & 3 and it will work fine. The omitted arguments' variables will evaluate to IsEmpty()=true, as you can see on lines 3 & 4 of the code snippet above.

In Pro, however, I guess it crashes the program, since nothing displays at all!

Fortunately, I found the solution pretty quickly, but it's pretty frustrating that these don't work the same on all platforms. Doubly frustrating is the lack of Console or debugger in Pro. It's also frustrating that Pro will only set the popup settings once when the layer is added to Pro, so any updates made on AGOL are never picked up. You have to delete the layer from your map and re-add it.

Side note: You can also call an AGOL Arcade function with extra arguments not in the signature. I discovered this accidentally and don't know how you'd ever access them, but it doesn't fail. This crashes the Arcade popup in Pro.

View solution in original post

1 Reply
davedoesgis
Occasional Contributor III

It looks like the culprit is a difference in how the language works in AGOL popups vs. in Pro. I thought the whole point of Arcade was that it runs the same everywhere!!!

In short, AGOL Arcade functions support optional arguments. If I omit a function argument in AGOL, the variable will be null. I can test for it with the IsEmpty() function. For example, this simple function will print out a field value (argument 1), but if the field value is null or empty, then it will spit out a placeholder message (argument 2) in a different color (argument 3).

function textPlaceholder(input, placeholder, color) {
	if (!IsEmpty(input)) return input;
	if (IsEmpty(placeholder)) placeholder = '[n/a]'
	if (IsEmpty(color)) color = colors_faded;
	return `<span style="color: ${color};">${placeholder}</span>`
}

If I call this on AGOL, I can omit arguments 2 & 3 and it will work fine. The omitted arguments' variables will evaluate to IsEmpty()=true, as you can see on lines 3 & 4 of the code snippet above.

In Pro, however, I guess it crashes the program, since nothing displays at all!

Fortunately, I found the solution pretty quickly, but it's pretty frustrating that these don't work the same on all platforms. Doubly frustrating is the lack of Console or debugger in Pro. It's also frustrating that Pro will only set the popup settings once when the layer is added to Pro, so any updates made on AGOL are never picked up. You have to delete the layer from your map and re-add it.

Side note: You can also call an AGOL Arcade function with extra arguments not in the signature. I discovered this accidentally and don't know how you'd ever access them, but it doesn't fail. This crashes the Arcade popup in Pro.