Select to view content in your preferred language

ArcGIS Online Arcade Gone Wrong

725
1
09-09-2020 11:16 AM
JordanMiller4
Frequent Contributor

Why can't i return information accessing a related table using the arcade code on a feature class? I'm requesting an assignmentID from the feature, placing the ID in a sql expression; accessing the related table and filtering the results to match the ID with the description and returning the results when a user clicks on a point. Right now it returns blank. Any ideas?

//  read out the ID of the assignment type
var assignmentID = $feature["assignmenttype"];

// create a sql expression to query on ID
var sql = "Assignment = '" + assignmentID + "'";

// access table data
var tbl = FeatureSetByName($datastore,"Assignment Types");


var related_data = Filter(tbl, sql);

return related_data‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Jordan Miller ,

Let's assume that the filter is executed correctly (which could be wrong depending on the format of the data).

The main issue here is the fact that you return a featureset. Featuresets can be displayed when you test the expression in the expression editor, but will not be shown up in the pop-up. You will need to go through each feature in the featureset and extract the information you need and create a text that you want to show in the pop-up. 

Some examples where this is explained in detail are: