Select to view content in your preferred language

Creating Pop Ups with Related Table (FeatureSetByPortalItem)

459
10
Jump to solution
05-23-2024 11:12 AM
GrantCountyGISSup
New Contributor III

I have created a Web Map in Enterprise 11.1 Portal.  One of the layers used in the web map has a joined table for connecting Tax Parcels with Ownership and Tax information.

After doing quite a bit of research, I have determined that the only way to incorporate data from the joined table is by using an Arcade Expression.

There are several descriptive articles out there but the one that I followed to make my expression is is an ESRI Technical Support How To.

I typed it out in the Arcade Playground and it appears that a single line is causing this to fail, however, after multiple attempts I still cannot figure out how to fix it.  On line 23, I get an invalid expression:

GrantCountyGISSup_0-1716487428579.png

I have tried switching it out with

popupString += "Parcel ID: " + DefaultValue(f.PARCELID, 'No Info') + TextFormatting.NewLine

or

popupString += "Parcel ID: " + Text(f.PARCELID) + TextFormatting.NewLine

 

Nothing seems to want to let this expression work.

Is there anything that I am missing?  I am not good with Arcade or debugging in general, so this might be completely off.  Any help or advice would be well worthwhile for me.

 
var portal = Portal("https://gcarcgis.co.grant.wi.gov/")

var RelatedTable =
// Fetches OWNER TAX TABLE from a public portal item
FeatureSetByPortalItem(
  Portal,
  // portal item id
  "d65d041ad4ed48f290a4669c4607206f",
  11, // layer id
  ['PARCELID','OWNERNME1', 'OWNERNME2', 'PSTLADRESS', 'SITEADRESS', 'SCHOOLDIST', 'SCHOOLDISTNO', 'CNTASSDVALUE', 'LNDVALUE', 'IMPVALUE', 'ESTFMKVALUE', 'NETPRPTA', 'GRSPRPTA', 'PROPCLASS', 'AUXCLASS', 'ASSDACRES', 'DEEDACRES', 'WEBPIN' ], // fields to include
  false // include or exclude geometry
);

var CommonAttr = $feature.Name

var FilterStatement = 'PARCELID = @CommonAttr'

var relatedData = Filter(RelatedTable, filterStatement)

var popupString = ''
for(var f in relatedData){
 
  popupString += Text(f.PARCELID) + TextFormatting.NewLine +
 
  "First Owner Name: " + DefaultValue(f.OWNERNME1,'No Info') + TextFormatting.NewLine +
  "Second Owner Name: " + DefaultValue(f.OWNERNME2,'N/A') + TextFormatting.NewLine +
  "Postal Address: " + DefaultValue(f.PSTLADRESS, 'No Info') + TextFormatting.NewLine +
  "Property Address: " + DefaultValue(f.SITEADRESS, 'None') + TextFormatting.NewLine +
  "School District and ID: " + DefaultValue(f.SCHOOLDIST, 'N/A') + ' ' + DefaultValue(f.SCHOOLDIST, 'N/A') + TextFormatting.NewLine +
 
  TextFormatting.NewLine +
   "Assessment Information " + TextFormatting.NewLine +
  "Total Assessed Value: $" + DefaultValue(f.CNTASSDVALUE,'No Info') + TextFormatting.NewLine +
  "Land Value: $" + DefaultValue(f.LNDVALUE,'No Info') + TextFormatting.NewLine +
  "Improvement Value: $" + DefaultValue(f.IMPVALUE,'No Info') + TextFormatting.NewLine +
  "Estimated Fair Market Value: $" + DefaultValue(f.ESTFMVALUE,'No Info') = TextFormatting.NewLine +
 
  TextFormatting.NewLine +
  "Tax Information" + TextFormatting.NewLine +
  "Gross Property Tax: $" + DefaultValue(f.GRSPRPRTA, 'No Info') + TextFormatting.NewLine +
  "Net Property Tax: $" + DefaultValue(f.NETPRPTA, 'No Info') + TextFormatting.NewLine +

  TextFormatting.NewLine
  "Acreage Information: " + "Assessed Acres: " + DefaultValue(f.ASSDACRES, 'No Info') + " Deeded Acres: " + DefaultValue(f.DEEDACRES, 'No Info') + TextFormatting.Newline +
  TextFormatting.NewLine

}

DefaultValue(popupString, 'No information at this time.')
0 Kudos
10 Replies
ZachBodenner
MVP Regular Contributor

Yeah so that return syntax is only for Arcade elements. if you're going to be including it as an expression in a Text element, then ditch everything except the popup_str variable and go back to reading it as "Return popup_str"