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.
The null output is likely due to a mismatch in field names or data types. Make sure $feature.ma and the table’s parcelid are the same type, and that the values match exactly (no extra spaces). Also, verify the field names in the table are correct.
It looks like the filter might not be matching due to data type or field name differences. Try using Text() to ensure both fields are strings:
var filteredTable = Filter(table, "parcelid = '" + Text(OwnerAdd) + "'")
Also confirm the field names in your table exactly match the ones used in the script and that the Portal() URL is accessible from your environment.
Try matching the field names exactly as they appear in your table and make sure the parcelid types match (string vs number). If parcelid in your table is text, cast it in the filter:
var filteredTable = Filter(table, "parcelid = '" + OwnerAdd + "'")
Also confirm the portal item ID and layer index are correct — null output usually means the filter isn’t returning any rows.