Hello
I have this code which return specific fields but right now I need to return all values. I can write all attribute in code but the table I refer has lots of fields. is it any way I can get all fields on table to use it in pop up in web map
var fips = $feature["parent_id"]
var dd = FeatureSetByName($map,
"Survey v2", ['age','gender','race'],False)
var fillterSur = "survey_id = @fips"
var cou = First(Filter(dd, fillterSur))
var popupTEXT = "Age: "
+Text(cou,'#,###')
var popupTEXT = "gender: "
+Text(cou,'#,###')
var popupTEXT = "race: "
+Text(cou,'#,###')
return popupTEXT
Solved! Go to Solution.
var fips = $feature["parent_id"]
var dd = FeatureSetByName($map, "Survey v2", ['age', 'gender', 'race'], false)
var fillterSur = "survey_id = @fips"
var cou = First(Filter(dd, fillterSur))
if(cou == null) { return "no survey found" }
var attributes = Dictionary(Text(cou))["attributes"]
var popup_lines = []
for(var a in attributes) {
var line = `${a}: ${attributes[a]}`
Push(popup_lines, line)
}
return Concatenate(popup_lines, TextFormatting.NewLine)
Something like this?
var attributes = Dictionary(Text($feature))["attributes"]
var popup_lines = []
for(var a in attributes) {
var line = `${a}: ${attributes[a]}`
Push(popup_lines, line)
}
return Concatenate(popup_lines, TextFormatting.NewLine)
Thanks Sorry I am kinda new to this Arcade code
How can I combine your code with mine.
var fips = $feature["parent_id"]
var dd = FeatureSetByName($map, "Survey v2", ['age', 'gender', 'race'], false)
var fillterSur = "survey_id = @fips"
var cou = First(Filter(dd, fillterSur))
if(cou == null) { return "no survey found" }
var attributes = Dictionary(Text(cou))["attributes"]
var popup_lines = []
for(var a in attributes) {
var line = `${a}: ${attributes[a]}`
Push(popup_lines, line)
}
return Concatenate(popup_lines, TextFormatting.NewLine)
Thanks @JohannesLindner This is working fine but if I don't want to list attributes and bring everything without writing because table has lots of fields
I'm not quite sure what your question is. I'm assuming you want to limit the fields that get printed. You can do that like so:
var fips = $feature["parent_id"]
var dd = FeatureSetByName($map, "Survey v2", ['age', 'gender', 'race'], false)
var fillterSur = "survey_id = @fips"
var cou = First(Filter(dd, fillterSur))
if(cou == null) { return "no survey found" }
var attributes = Dictionary(Text(cou))["attributes"]
var print_fields = ["age", "gender", "race"] // define the fields you want to print in the popup
var popup_lines = []
for(var f in print_fields) {
var a = print_fields[f]
var line = `${a}: ${attributes[a]}`
Push(popup_lines, line)
}
return Concatenate(popup_lines, TextFormatting.NewLine)