Popup Title does not recognize single quote

1035
7
Jump to solution
08-18-2021 09:51 AM
Paul_Christensen
Occasional Contributor

Pro 2.8.2

I am trying to get my Popup Title to properly display Quadrant Bearing coordinates such as S84°07'50"W.

Using the parcel fabric's default popup expression, this looks like S84°0750'W.

A snippet of the default expression looks like:

 

quadbearing=prefix+degrees+"°"+text(minutes,"00")+"'"+text(seconds,"00")+"''"+postfix

 

If I change it to look like this:

 

quadbearing=prefix+degrees+"°"+text(minutes,"00")+TextFormatting.SingleQuote+text(seconds,"00")+TextFormatting.DoubleQuote+postfix;

 

The output is closer, S84°0750"W, but it is missing the Single Quote after the minutes.

I have even tried just a simple expression like:

 

{insertrandomfield} + "'"

 

or

 

{insertrandomfield} + TextFormatting.SingleQuote

 

and neither will display the single quote in the Title. They just display the field attribute.

The single quote displays fine using the exact same expression in the Attributes panel.

 

I put this in ArcGIS Pro and not in Parcel Fabric because it doesn't seem unique to the Parcel Fabric. But, @AmirBar-Maor, do you have any ideas for this? Either way, the built in default fabric popup expression for lines isn't working right for me.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AmirBar-Maor
Esri Regular Contributor

@Paul_Christensen 

The display expression is very similar but it is stripped from the text formatting for the font (color, size...).

I am using the next release of the software for testing (2.9) which explains why I am getting different results. It used to work - so this could be a bug (regression).

If you are OK with the current display for the interim period, you might want to consider contacting technical support that can reproduce it on 2.8 and log an issue. It seems to me like a regression so you might want to minimize performing any changes to the expression.  

The (awesome) Arcade team is already looking into it.

View solution in original post

7 Replies
AmirBar-Maor
Esri Regular Contributor

Good job @Paul_Christensen!

Looping @RichardShepherd 

Have a look at this post where Richard mentions the new Arcade capabilities to format a direction using the ConvertDirection function (https://developers.arcgis.com/arcade/function-reference/geometry_functions/#convertdirection).

The default popups for parcel fabric lines should show you the direction using quadrant bearing. You can get the default symbology if you simply add the parcel fabric to a new map:

AmirBarMaor_0-1629365168743.png

 

 

0 Kudos
Paul_Christensen
Occasional Contributor

Amir,

I have tried adding the fabric to a new map, and the default popup expression still gives me troubles.

Popup.png

As far as I can tell, the default custom display expression (Layer Properties > Display >  Display Field > Set an Expression) uses an identical expression to the popup and the Attributes panel shows the correct format.

Your popups display correctly? Hmm. Could it be a setting or system configuration for me? 

I was able to construct a new expression using the new ConvertDirection function, however, it still excludes the single quote. You can see the default fabric expression followed by the ConvertDirection expression.

Paul_Christensen_0-1629395865968.png

Thank you for looking at this with me!

-Paul

Here is the full default fabric popup expression.

 

// Change the settings portion to configure direction format, rounding and abbreviations
// This is an Arcade expression

// SETTINGS
var QuadrantBearingFormat = true; //set 'true' for quadrant bearing, 'false' for north azimuth
var ShowDistance = true;   //set as 'true' to show distance
var ShowDirection = true;  //set as 'true' to show direction
var ShowRadius = true;     //set as 'true' to show radius
var ShowCurveParemater = true;    //set as 'true' to show a curve parameter
var CurveParameter = "ArcLength"; //set as 'ArcLength' or 'Chord' or 'Angle' for central angle. Case sensitive!
var ErrorString = "COGO ERROR";   //set to display invalid COGO combinations
var RadiusAbbr = 'R=';     //radius abbreviation
var Radius2Abbr = 'R2=';     //radius2 abbreviation for spiral curves
var ArclengthAbrr = 'L=';  //arclength abbreviation
var ChordAbbr = 'C=';      //chord abbreviation
var AngleAbbr = 'A=';      //central Angle abbreviation
var DistUnitRounding = 2;  //number of decimal places for distance units: distance, radius, arclength & chord
var NumberFormat = "#,###.00" //number format. In this example: thousands separator with padding of 2 zeros 

// VARIABLES
var direction=$feature.Direction;
var distance=$feature.Distance;
var radius=$feature.Radius;
var arclength=$feature.Arclength;
var radius2=$feature.Radius2
var prefix;  // quadrant bearing prefix
var postfix; // quadrant bearing postfix
var bearing; 
var quadbearing;
var binaryDictionary; //binary dictionary to check COGO combinations
var checksum=0; //initialize checksum
var validValuesArray; //array of valid values for COGO combinations
var partialValuesArray; //array of partial values for COGO
var degrees;
var minutes;
var seconds;
var DMS;
var directionStr = ""; //direction string using for label
var distanceStr = "";  //distance string using for label
var radiusStr = "";    //radius string using for label
var radius2Str = "";    //radius2 string using for labeling spiral curves
var curveStr = "";     //curve parameter string using for label
var angleRad; //curve angle in radians
var COGOValidity; //COGO combinations validity. can be valid, partial or invalid.


function NorthAzimuth2Quadbearing(azimuth){
            if (azimuth<90 && azimuth>=0){
                        bearing=azimuth;
                        prefix = "N";
                        postfix= "E";}
            else if (azimuth<180 && azimuth>=90){
                        bearing=180-azimuth;
                        prefix = "S";
                        postfix= "E";}
            else if (azimuth<270 && azimuth>=180){
                        bearing=abs(180-azimuth);
                        prefix = "S";
                        postfix= "W";}
            else if (azimuth<360 && azimuth>=270){
                        bearing=360-azimuth;
                        prefix = "N";
                        postfix= "W";}
            
            degrees=floor(bearing);
            minutes=floor((bearing-degrees)*60)
            seconds=((bearing-degrees-minutes/60)*3600)
            if (seconds>=59.5){
                seconds=0;
                minutes+=1;
                if (minutes==60){
                    minutes=0;
                    degrees+=1;}}
            quadbearing=prefix+degrees+"°"+text(minutes,"00")+"'"+text(seconds,"00")+"''"+postfix;
            return quadbearing;
}

function DMS(bearing){
    degrees=floor(bearing);
    minutes=floor((bearing-degrees)*60)
    seconds=((bearing-degrees-minutes/60)*3600)
    if (seconds>=59.5){
        seconds=0;
        minutes+=1;
        if (minutes==60){
            minutes=0;
            degrees+=1;}}
    DMS=degrees+"°"+text(minutes,"00")+"'"+text(seconds,"00")+"''";
    return DMS;
    
}
function IsValidCOGO(direction, distance, radius, arclength, radius2) {
    binaryDictionary= Dictionary('dir', 1, 'dist',2, 'rad',4, 'arc',8, 'rad2',16)
    if (!IsEmpty(direction)) {checksum+=binaryDictionary.dir}
    if (!IsEmpty(distance)) {checksum+=binaryDictionary.dist}
    if (!IsEmpty(radius)) {checksum+=binaryDictionary.rad}
    if (!IsEmpty(arclength)) {checksum+=binaryDictionary.arc}
    if (!IsEmpty(radius2)) {checksum+=binaryDictionary.rad2}
    
    validValuesArray=[0,3,8,13,29]; //array of valid combinations: '0' for nothing, ... '13' for direction & radius & arclength ...
    partialValuesArray=[1,2,4,20,13,16,21,25,28]; //array of partial combinations: '1' for only direction, '2' for only distance...
        
    if (IndexOf(validValuesArray,checksum)>-1) { // a negative value is returned if checksum value is not in the a valid combination array
        return "valid";
    }
    if (IndexOf(partialValuesArray,checksum)>-1){
        return "partial";        
    }
    return "invalid";
}

COGOValidity = IsValidCOGO(direction, distance, radius, arclength, radius2);
if ( COGOValidity == "invalid") { //if invalid COGO return error string
    return ErrorString;    
}

// Direction string
if (ShowDirection) {
    if (IsEmpty(direction)==false) { 
        if (QuadrantBearingFormat==true) {  //using quadrant bearing format
                directionStr = NorthAzimuth2Quadbearing(direction);
        }
        else {  //using north azimuth format
            directionStr = DMS(direction);
        }
    }
}

// Distance string
if (ShowDistance) {
    if (IsEmpty(distance)==false) {
    distanceStr = text(round(distance,DistUnitRounding), NumberFormat);
    }
}

//Radius String
if (ShowRadius) {
    if (!IsEmpty(radius)) { //it can be a curve or a spiral
        if (IsEmpty(radius2)) { //if radius2 is empty this is a curve
            radiusStr = RadiusAbbr + " " + text(round(radius, DistUnitRounding), NumberFormat);
        }
        else { // it is a spiral
            radiusStr = RadiusAbbr + " " + text(round(radius, DistUnitRounding),NumberFormat);
            radius2Str = Radius2Abbr + " " + text(round(radius2, DistUnitRounding),NumberFormat);
            if (radius == 0) { //substitute to infinity sign
                radiusStr = RadiusAbbr + " ∞ ";
            }
            if (radius2 == 0) { //substitute to infinity sign
                radius2Str = Radius2Abbr + " ∞ ";
            }
        }    
        
    }
}
// Curve Parameter
if (ShowCurveParemater) {
        if (!IsEmpty(arclength)) {
            if (CurveParameter == 'ArcLength') {
                curveStr = ArclengthAbrr + text(round(arclength, DistUnitRounding), NumberFormat); //return Arc length                
            }
            angleRad = arclength/(abs(radius)) //calculate angle in radians
            if (CurveParameter == 'Angle') {
                curveStr = AngleAbbr + DMS(angleRad * 180 / pi); // convert radian to degrees and show as DMS
            }
            if (CurveParameter == 'Chord') {
                curveStr = ChordAbbr + text(round((2 * abs(radius) * Sin(angleRad/2)),DistUnitRounding), NumberFormat); //calculate chord length
            }            
        }
}
    
// Assemble label string
if (IsEmpty(radius)) { //if its empty it is not a curve
    return directionStr + "   " + distanceStr
}
else { //it's a curve
    return radiusStr + " " + radius2Str + "  " + curveStr;
}

 

0 Kudos
AmirBar-Maor
Esri Regular Contributor

@Paul_Christensen 

The display expression is very similar but it is stripped from the text formatting for the font (color, size...).

I am using the next release of the software for testing (2.9) which explains why I am getting different results. It used to work - so this could be a bug (regression).

If you are OK with the current display for the interim period, you might want to consider contacting technical support that can reproduce it on 2.8 and log an issue. It seems to me like a regression so you might want to minimize performing any changes to the expression.  

The (awesome) Arcade team is already looking into it.

Paul_Christensen
Occasional Contributor

@AmirBar-Maor 

I understand. I will wait for the next release!

If anything, I gained a little knowledge on arcade expressions.

Many thanks,

-Paul

0 Kudos
SimonHawker1
Esri Contributor
Hi Paul, I'm looking into this but I'm not having much luck reproducing. Would you be able to share a project package that demonstrates the issue? Arcade has a console function that can be used to check the output at various points during validation. It might be helpful for narrowing down where this issue is coming in.
0 Kudos
Paul_Christensen
Occasional Contributor

Simon,

Thank you for looking into this.

Unfortunately,  I am experiencing this on any popup in any Project, including a new project on newly created data, so sending you data wont help. Even non-parcel fabric data, if an expression is supposed to display a single quote in the title field, it wont show.

I recently did a complete fresh install of 2.8 and then upgraded manually to 2.8.2 using downloaded files as opposed to using the built in updater and the issue persists.

The popup Title does not display a single quote only if using an expression. For instance, if the Title Options is populated like {expression/expression0}', adding a single quote after the expression, the single quote is displayed after the expression's text. But if the expression itself includes a single quote, it wont display.

 

This isn't a show stopping bug, so I'll wait until 2.9 rolls out. 

0 Kudos
SimonHawker1
Esri Contributor
Hi Paul, thanks for getting back to me. With those steps, I was able reproduce the issue in 2.8 and I couldn't reproduce it in 2.9.