I'm attempting to pull data from a feature service table and share information in a linked feature pop up using the Arcade content element. When testing the code in the AGOL Developers sandbox, the code returns the correct formatting with line breaks after each line, but when running in the pop up, everything is returned as a continuous string. I have tried both the '\n' and TextFormmatting.NewLine formats for the line break, with no success. Code and screenshots from web map and sandbox below...
var permits = FeatureSetByPortalItem(***);
var BAA = 'WITTENBURG'
var filterStatement = 'BAA = @BAA'
var BAApermits = Filter(permits, filterStatement)
BAApermits = OrderBy(BAApermits, "Permit_Date_Start ASC")
var countPermits = Count(BAApermits)
var fsprint = []
var n = 0
for(var r in BAApermits){
var baaname = r.BAA
var permitType = r.Permit_Type
var permitStart = Text(r.Permit_Date_Start, "MM/DD/YYYY")
var permitEnd = Text(r.Permit_Date_End, "MM/DD/YYYY")
var permitDates = IIF(permitStart == permitEnd, permitStart, Concatenate([permitStart, '-', permitEnd], ' '))
n += 1
Push(fsprint, Concatenate([n, ". ", permitDates], ""));
}
var out = IIF(countPermits > 0,Concatenate(fsprint, TextFormatting.NewLine), '')
return {
type : 'text',
text : out
}
Sandbox (good formatting)
Pop up (bad formatting)
Solved! Go to Solution.
Well, all it took was to post here and I figured it out...
Thanks to some suggested posts alongside this post, here and here, it seems like the issue has something to do with the return as text bit at the bottom, in which the formatting is stripped. For some reason, if i just change by code to return out, the whole section fails to render in the pop up. However, when i change the new line method to the HTML </br>, it works. The HTML tags seem to be honored within the text element, while the TextFormatting and \n options are not.
Web Viewer Classic is built with JavaScript 3.x, which doesn't support '\n' or TextFormmatting.NewLine. The new Map Viewer is built with Javascript 4.x, which does support these.
I am using the new Map Viewer
Well, all it took was to post here and I figured it out...
Thanks to some suggested posts alongside this post, here and here, it seems like the issue has something to do with the return as text bit at the bottom, in which the formatting is stripped. For some reason, if i just change by code to return out, the whole section fails to render in the pop up. However, when i change the new line method to the HTML </br>, it works. The HTML tags seem to be honored within the text element, while the TextFormatting and \n options are not.