Select to view content in your preferred language

Popup arcade expression isn't honored in Field Maps

495
1
02-23-2024 01:01 PM
JordanSwart1
New Contributor

I created popup's for a layer that is referencing a related table. I can get the popup to successfully load and format the data correctly in the web map, but there is no formatting in the Field Maps mobile app (running the latest version of the app on an iphone 13 mini).  I included my code and images of what it looks like in the web map and Field Maps. Thank you! web-map.PNGfield_maps.jpg

 

 

// Access historical Pediocactus data table as a FeatureSet
var portal = Portal("https://www.arcgis.com")
var PedioData = FeatureSetByPortalItem(portal,
    "4c30a4a99eac4773bfa61ea52c3e806e", 41, ['Current_Tag', 'Status',
    'F__Heads', 'Width__mm_','Tag_Type__B_A_', 'Notes','Proofing_notes', 'Year'])

// Filter related features by using a common attribute
var TAG = $feature.ID
var filterStatement = 'Current_Tag = @TAG'

// Related features as a variable
var relatedData = Filter(PedioData, filterStatement)

// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(relatedData, 'Year DES')

// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedDataSorted){
    
    popupString += Text(f.Year) + '\n' +
    
        "ID: " +
        DefaultValue(f.Current_Tag, 'no data') + '\n' +
        
        "Status: " +
        DefaultValue(f.Status, 'no data') + '\n' +

        "Tag Type: " +
        DefaultValue(f.Tag_Type__B_A_, 'no data') + '\n' +
        
        "# of heads: " +
        DefaultValue(f.F__Heads, 'no data') + '\n' +
        
        "Width (mm): " +
        DefaultValue(f.Width__mm_, 'no data') + '\n' +

         "Notes: " +
        DefaultValue(f.Notes, 'no data') + '\n' +

        "Proofing Notes: " +
        DefaultValue(f.Proofing_notes, 'no data') + '\n\n'

        
}

DefaultValue(popupString, 'No measurements to show')

 

 

Tags (3)
0 Kudos
1 Reply
ChristopherCounsell
MVP Regular Contributor

Field Maps does not interpret "TextFormatting.NewLine" or "/n" properly. If you want to add them, you have to use the Arcade element in the popup (not text element) and <br>

var test = ['A','B','C'];
var output = '';
for (var i in test)
{
	output += `${test[i]} <br/>`;
}

return { 
	type : 'text', 
	text : output //this property supports html tags 
}

 

See here for more:

https://community.esri.com/t5/arcgis-field-maps-questions/unable-to-create-new-line-in-arcade-popup/...

 

0 Kudos