Hello,
I have a data collection layer for FieldMaps and a table stored on the Portal. Based on the Parcel ID on the data collection layer, I am trying to populate the owner address in the collection layer from the table. I am basing the Arcade expression on this post.
var OwnerAdd = $feature.ma
var table = FeatureSetByPortalItem(Portal('https://xyz/portal/'),'61fe20149cd74fff91209b580f841145', ['parcelid', 'owner'])
var filteredTable = Filter(table, "parcelid = @OwnerAdd")
var result = First (filteredTable)
if(!IsEmpty(result)){
return result.owner
}When I test it , it provides a null output and it does not work in the form.
Any help would be appreciated.
Hi @dsinha,
Have you used the Console() function to see if there is any result for the feature? You can also verify that there are records by using the Count() function in conjunction with the Console() to see if there are any records that are returned by your query. It could be that either the query is resulting in no records returning or that there is something else going on.
Did you double check that the field name(s) exist and you are filtering for the correct data? Ex. ("ParcelPin = '1000000'") vs (ParcelPin = 1000000"). If you use the console then it should help troubleshoot the issue.
One change to make is you have to check empty before using first. The sample code they have out there is wrong. I told them but it never got changed. If you call first on an empty list it fails.
For filter not sure why the @ symbol is in there? I do it like this with a sql in a var and it works. Also note wrap filter around the FeatureSet call is faster since its one call not 2. Also set return geo to false is faster.
var EvaluationID = Concatenate($feature.PlotID, "_", text(ToLocal($feature.FieldEvalDate), "Y-MM-DD"))
var sql = "EvaluationID = '" + EvaluationID + "'";
var tbl = Filter(FeatureSetByName($map,"Site Evaluation", ['EvaluationID'], false), sql);
hope that does it.