Select to view content in your preferred language

Expression Popup Formatting

1000
6
08-09-2022 04:43 PM
RyanTucker
Regular Contributor

Portal 10.8.1 Popup expressions that are pulling from related tables work fine and are formatted correctly in map viewer classic popups. But when I view the popups in WebAppBuilder the popups are all bunched together.

Any ideas? 


0 Kudos
6 Replies
JohannesLindner
MVP Frequent Contributor

Can you post the code please?

 

JohannesLindner_0-1660119690686.png

JohannesLindner_1-1660119702048.png

 


Have a great day!
Johannes
RyanTucker
Regular Contributor

@jcarlson @JohannesLindner 

The Arcade code I'm using is below. Thank you for taking a look. 

 

/* 
   Access 'Parcels has SiteAddressPoints' relationship using the function 
   FeatureSetByRelationshipName. This will pull all Base addresses on the 
   parcel from Site Address Points feature
*/

// These are the fields that need to be accessed from the related table
var assrFields = ['SITEADDID', 'FULLADDR']

// This is the variable to pull the related table records
var relatedrecords = (FeatureSetByRelationshipName($feature, 'SiteAddressPoint', assrFields, false))


// Declare variables 
var popupString = ''
var linebreak = "-------------------------"

/* 
   the popup expression is constructed by using a
   For Loop to iterate through all related features 
*/

for (var f in relatedrecords)
{
popupString += linebreak
    // If SITEADDID is not empty then add declared variable "a" to the popupString
    if (!IsEmpty(f.SITEADDID)){
        var a = (TextFormatting.NewLine + "APN: " + f.SITEADDID)
        popupString += a
    }
    // If FULLADDR is not empty then add declared variable "a" to the popupString    
    if (!IsEmpty(f.FULLADDR)){
        var a = (TextFormatting.NewLine + f.FULLADDR)
        popupString += a
    }
    
popupString += TextFormatting.NewLine + linebreak    
}  

return popupString

 

 

0 Kudos
jcarlson
MVP Esteemed Contributor

How are you handling line breaks in your popup expression? It looks like that's probably the cause, somehow WAB is ignoring your line breaks.

- Josh Carlson
Kendall County GIS
0 Kudos
JohannesLindner
MVP Frequent Contributor

Hmmm... I can't reproduce this, they look the same to me:

Map Viewer Classic: 
JohannesLindner_0-1660197841748.png

Web App Builder:
JohannesLindner_1-1660197919336.png

 

But, notice that the first "linebreak" line in my popups is only half length (the last one, too)? If you look at your code, that makes sense: At the end of each iteration, you add a new line and linebreak, at the start you add linebreak. So for each iteration except the first, the dashed line on top will be 2 * linebreak.

Looking at your popups, I don't see that behavior, so unless I'm missing something, this doesn't seem to be the code your popups use.

 

Anyway, try a slightly different approach:

var linebreak = "-------------------------"
var popupLines = [linebreak]  // we're using an array to store the lines of the popup

for (var f in relatedrecords) {
    // If SITEADDID is not empty, push it into the array
    if (!IsEmpty(f.SITEADDID)){
        Push(popupLines, "APN: " + f.SITEADDID)
    }
    // If FULLADDR is not empty, push it into the array
    if (!IsEmpty(f.FULLADDR)){
        Push(popupLines, f.FULLADDR)
    }
    // get the dashed line in
    Push(popupLines, linebreak)
}  
// Concatenate the array with NewLine and return
return Concatenate(popupLines, TextFormatting.NewLine)

 


Have a great day!
Johannes
RyanTucker
Regular Contributor

@JohannesLindner  Thanks for looking.

Im thinking the issue is deeper than Arcade for the following reasons:

1. This happens on Chrome, Edge, and IE11(Still have a machine with IE).  

2 .  When I highlight the popup info in Map Viewer Classic and inspect it under Chrome the <span> tags      have  class="newcharline"   in the code

When I highlight the popup info in WebAppBuilder and inspect it under Chrome the <span> tags are missing the class="newcharline" code. 

I have a ticket with tech support open on this as of this morning.

 

 

0 Kudos
RyanTucker
Regular Contributor

I ended up having to upgrade my Portal setup to 10.9.1 to resolve the issue.

0 Kudos