<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:inherit;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-CA link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi Devs,</p><p class=MsoNormal>I’m sending you a link to my post on Stack Overlow, requesting assistance!</p><p class=MsoNormal><a href="https://stackoverflow.com/questions/51812251/qgis-expressions-dont-evaluate-as-expected">https://stackoverflow.com/questions/51812251/qgis-expressions-dont-evaluate-as-expected</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I would really appreciate your help. I am pasting the content of my post on stack overflow below for your convenience.</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.5pt;padding:0cm 0cm 1.0pt 0cm'><p class=MsoNormal style='border:none;padding:0cm'>Evan Kanter<br>evankanter28@gmail.com<br><br></p></div><p style='margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>I am using QGIS with a vector layer and the attribute table stored at this link:<a href="https://docs.google.com/spreadsheets/d/1K7rRdlcSheclJ6MqzpBNwSZei911WDV1Bl2zBGV38-s/edit?usp=sharing"><span style='font-family:"inherit",serif;color:#005999;border:none windowtext 1.0pt;padding:0cm'>https://docs.google.com/spreadsheets/d/1K7rRdlcSheclJ6MqzpBNwSZei911WDV1Bl2zBGV38-s/edit?usp=sharing</span></a><o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>I then have the following code:<o:p></o:p></span></p><pre style='background:#EFF0F1;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;max-height: 600px;word-wrap: normal;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;overflow:auto;word-spacing:0px'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>CASE<o:p></o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'><o:p> </o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>/*Kieran Winner*/<o:p></o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>WHEN "r_Kieran" > "r_Wynne" <o:p></o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>        THEN ramp_color('PCMarg', scale_linear(("r_Kieran"/"r_TOTAL"-"r_Possian"/"r_TOTAL"),  0,  1, 0, 1))     <o:p></o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>ELSE color_rgb(64, 224, 208)<o:p></o:p></span></code></pre><pre style='background:#EFF0F1;vertical-align:baseline'><code><span style='font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#EFF0F1'>END<o:p></o:p></span></code></pre><p style='margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>Here's the problem: </span><strong><span style='font-size:11.5pt;font-family:"inherit",serif;color:#242729;border:none windowtext 1.0pt;padding:0cm'>The code evaluates incorrectly.</span></strong><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'><o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>Take row 15 of the attribute table for example. (Where PD_Number=14) You would expect that the condition would evaluate TRUE since "r_Kieran"=397 and "r_Wynne"=225.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>But, it evaluates FALSE in QGIS, as indicated by the colour that is displayed on the map!<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>I've spent hours simplifying code, and pulling my hair out over this.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>Please help!<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm;background:white;vertical-align:baseline;font-variant-ligatures: normal;font-variant-caps: normal;font-variant-numeric: inherit;font-variant-east-asian: inherit;font-stretch: inherit;line-height:inherit;box-sizing: inherit;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729'>Thanks, Evan<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>