I have a related table that is published to my portal with a many to one relationship with my feature class.
I'm trying to pull the related records from the table into the feature class' popup using the following script(adapted from here):
var tbl = FeatureSetByName($datastore,"ConsumerAccess")
var ftr = $feature["Business.BusinessID"]
var sql = "BusinessID = '" + ftr + "'";
var txt = Filter(tbl,sql)
var outtxt = ""
for (var accesstype in txt){
var txts = ConsumerAccess.AccessType
outtxt += txts+TextFormatting.NewLine
}
return outtxt
I have tried using the DomainCode and DomainName functions within the declaring of the variable txts but I cant seem to get the description from the value. For example:
Thank you in advance if you have any suggestions
Solved! Go to Solution.
That worked!, I just needed to change one bit,
var tbl = FeatureSetByName($datastore,"ConsumerAccess")
var ftr = $feature["Business.BusinessID"]
var sql = "BusinessID = '" + ftr + "'";
var txt = Filter(tbl,sql)
var outtxt = ""
for (var accesstype in txt){
var txts = DomainName(accesstype, "AccessType")
outtxt += txts+TextFormatting.NewLine
}
return outtxt
I don't know why I was having so much trouble with it.
Thank you, and yes we shall see you next week!
(here is the link if you want to keep testing with it: https://staginggeo.grey.ca/portal/home/webmap/viewer.html?webmap=8d9616ee4d7f4b5dae20b4fd4cd60871 )
Hi Joel,
Try this:
ar tbl = FeatureSetByName($datastore,"ConsumerAccess")
var ftr = $feature["Business.BusinessID"]
var sql = "BusinessID = '" + ftr + "'";
var txt = Filter(tbl,sql)
var outtxt = ""
for (var accesstype in txt){
var txts = DomainName($feature.accesstype, "AccessType")
outtxt += txts+TextFormatting.NewLine
}
return outtxt
Can you share your web map so I can test this out?
Let me know if it gets you up and running and see you at UC.
That worked!, I just needed to change one bit,
var tbl = FeatureSetByName($datastore,"ConsumerAccess")
var ftr = $feature["Business.BusinessID"]
var sql = "BusinessID = '" + ftr + "'";
var txt = Filter(tbl,sql)
var outtxt = ""
for (var accesstype in txt){
var txts = DomainName(accesstype, "AccessType")
outtxt += txts+TextFormatting.NewLine
}
return outtxt
I don't know why I was having so much trouble with it.
Thank you, and yes we shall see you next week!
(here is the link if you want to keep testing with it: https://staginggeo.grey.ca/portal/home/webmap/viewer.html?webmap=8d9616ee4d7f4b5dae20b4fd4cd60871 )