I know I can create popup elements with arcade by using the popupElement item.
For example, I can recreate "tables" in a popup with arcade by using the "fields" type.
I'm trying to recreate the related records item so I can customise it further than the web map interface lets me.
However, I can't get it to work with the "relationship" type. To make sure I had it set up correctly, I added a related records item with the web map tools, downloaded the map json definition, and I was using exactly the same info. However, I can't get a related records item in a popup generated by arcade: nothing shows up in the rendered popup.
Here is the downloaded json relevant part (sorry for the weird formatting):
"popupInfo": {
"popupElements": [
// first popup: created with the web map interface tool
{
"type": "relationship",
"description": "",
"displayCount": 3,
"displayType": "list",
"orderByFields": [
{
"field": "category_id",
"order": "asc"
}
],
"relationshipId": 3,
"title": "related gui"
},
// second popup: tried to create with arcade, doesn't work, nothing shows up in popup
{
"type": "expression",
"expressionInfo": {
"title": "test arcade relation",
"expression": "return { "description": "desc",
"displayCount": 3,
"displayType": "list",
"title": "related arcade",
"orderByFields": [ {
"field": "category_id",
"order": "desc"
} ],
"relationshipId": 3,
"type": "relationship"};",
"returnType": "dictionary"
}
}
]
}
Anybody has a working example?
Thanks.
Solved! Go to Solution.
Ended up contacting support.
Turns out what I wanted to do is not possible.
While returning fields and values in a table with arcade ("fields" type) in the same way as adding the "fields" content element is possible, it is not possible do the same for other elements listed in the popupElement documentation, because they are not evaluated at the same time when the page and the map loads.
So I could write my related content within the map json and push it to AGOL, but it's not exactly what I wanted, I wanted to get only certain records from the related table and only show those. I'll go about it another way.
Ended up contacting support.
Turns out what I wanted to do is not possible.
While returning fields and values in a table with arcade ("fields" type) in the same way as adding the "fields" content element is possible, it is not possible do the same for other elements listed in the popupElement documentation, because they are not evaluated at the same time when the page and the map loads.
So I could write my related content within the map json and push it to AGOL, but it's not exactly what I wanted, I wanted to get only certain records from the related table and only show those. I'll go about it another way.