Select to view content in your preferred language

Format multi-line text in a Smart Form

165
4
04-22-2024 08:08 AM
colejo02
New Contributor II

Hello!  Is is possible to format multi-line text element to appear as a table?  I want inspectors to see a list of inspections that are in a related table.  Right now the result is too messy looking.  If it could be a fixed width or html table that would be better.  Thanks!

 

var pAPNO = $feature.txtAPNO
var FSetInspectionData = FeatureSetByName($map, "Inspection_DataSearch_Internet",['*'])
Console(Count(FSetInspectionData))
var FilterFSetInspectionData = Filter(FSetInspectionData, 'APNO = @pAPNO')
Console(Count(FilterFSetInspectionData))
var filterOrderedFSetInspectionData = OrderBy(filterFSetInspectionData,'scheddttm dsc')

var popupStringInsp = ''
for (var insp in filterOrderedFSetInspectionData){
  popupStringInsp +=insp.apno +" "+ 
  insp.DESCRIPT +" "+ 
  insp.STATUS +" "+ 
  Text(insp.SCHEDDTTM, 'MMM DD YYYY') +" "+ 
  insp.onemaparea +" "+ 
  insp.confirmno
  +TextFormatting.NewLine
}
return popupStringInsp

 

0 Kudos
4 Replies
DougBrowning
MVP Esteemed Contributor

The new map viewer has this feature built into the popup now.  Have you tried that?

0 Kudos
colejo02
New Contributor II

Hi Doug, Thanks for responding!  I have not tried that.  When I return the featureset,

return FI   //Featureset

the arcade Run shows the table with headings and values, but in the pop up it just says:

[object Object]

How do I access the built-in feature in the popup?  

I got this to kind of work, but I don't have a good handle on it.  I realize I probably need to use attributes with an array, but I'm struggling to make this work -- I'm having a hard time understanding the syntax in this example. Can you provide a little explanation, or what should I read to really get a good understanding?    

var SIA = FeatureSetByName($map, "SIA Transpo FullCouncil - School Impact Areas Full Council",["*"], true);
Console("SIA cnt: "+count(SIA));
var centerPt = Centroid($feature);
var FI = Intersects(SIA, centerPt); //another way to do it, Buffer($feature, -10, 'feet'));
var cntFI = Count(FI);
console(cntFI);

var a = [];
var Plan = [];

for(var item in FI){
  var SPA = "School Policy Area: " + item.Sheet1__SchoolPolicyAreaAlt1SPA;
  var PA = "Plan Area: "+ item["PlanningArea_Dissolve_4_8_20_Pl"];
  Push(a, SPA);
  Push(Plan, PA);
  
}

return {
  type: "Fields",
  SSP: a,Plan
  
};

The above script  returns the image below in the Pop-up.  The top is Text content showing the expression and the lower is the expression in a Field List window.   "SIA Arcade Exp" is the name of the expression. I also expect only one feature in the featureset, and I'm missing validation checks in the script.  I'll add these once I'm over this hump.  Thanks in advance for any help and advice. 😀 -Josh

colejo02_0-1713962235141.png

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Really confused what you are trying for here.  First I would just use the built in related stuff in the popup.  Easy and looks good.

On your code if you know there will be only one result then no need for a loop.

Seems like you are just returning these 2 fields?  If so can just send the text back.

return("School Policy Area:  " +  First(FI).Sheet1__SchoolPolicyAreaAlt1SPA  + "  Plan: " + First(FI).PlanningArea_Dissolve_4_8_20_Pl)

0 Kudos
colejo02
New Contributor II

Thanks and I apologize for starting in the middle.  My goal is to have a parcel layer pop up with information from 4 featuresets.  The information from each featureset is needed to help calculate impact taxes.  I'd like all the information brought together in a single pop up so a reviewer sees all the necessary information in a single window.  This makes it easier and quicker for them.

I'll intersect each layer to get the values. On the popup each featureset would have a Title and below the label and attribute values would appear in the standard two tone grey field list. Labels on the left and values on the right.  The title I can do with the out of the box pop up, but presenting the intersected label and attribute value in arcade is giving me fits.  I was planning to do each layer in its own expression and add them to a Field List.  

 

0 Kudos