<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Survey123 Calculation Won't Trigger Based On Hidden Value in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554224#M59854</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I’ve been working on some Survey123 Connect calculations to populate a survey question with an answer based on values contained in a separate feature layer called “Building Permits.” In that layer, the amount collected for an electric permit is stored in a field called “Electric_Amount.”&lt;BR /&gt;What I would like to do is update a question (called “erw_paid”) in a survey form linked to our Building Inspection layer based on the value of that payment field. If the “Electric_Amount” field contains anything other than “NaN”, I would like to have a question in the Building Inspection form update its value to “Yes.” The layers share a key field called “Permit ID”, so certain values can be retrieved using a “getValue” function.&lt;/P&gt;&lt;P&gt;I’ve been trying to accomplish this using a hidden field populated with a pull function and some logic responding to the value of that field, but the question never updates with the desired value when the form is opened. I’ve tried setting parameters for both to “calculationMode=auto”, but the calculation for the “erw_paid” question never seems to trigger even though it isn’t being held back by a relevant function. I’ve attached an Excel with the relevant lines, but I’ll include short snippets below as well:&lt;/P&gt;&lt;P&gt;Question 1:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Type: Decimal&lt;/LI&gt;&lt;LI&gt;Name: elec_hidden&lt;/LI&gt;&lt;LI&gt;Calculation: pulldata("@layer", "getValue", "attributes.ElectricPermit_Amount", "&lt;A href="https://services6.arcgis.com/cMgmhwu0L5CeOOoS/arcgis/rest/services/Department_of_Community_Development/FeatureServer/2" target="_blank" rel="noopener"&gt;https://services6.arcgis.com/cMgmhwu0L5CeOOoS/arcgis/rest/services/Department_of_Community_Development/FeatureServer/2&lt;/A&gt;", concat("PERMITID='",${permitid},"'"))&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Question 2:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Type: select_one yesno&lt;/LI&gt;&lt;LI&gt;Name: erw_paid&lt;/LI&gt;&lt;LI&gt;Calculation: if(${elec_hidden} != 'NaN', 'yes', 'no')&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Can anyone tell me where I might be going wrong here?&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 13:53:39 GMT</pubDate>
    <dc:creator>Marc_Patti</dc:creator>
    <dc:date>2024-10-31T13:53:39Z</dc:date>
    <item>
      <title>Survey123 Calculation Won't Trigger Based On Hidden Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554224#M59854</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I’ve been working on some Survey123 Connect calculations to populate a survey question with an answer based on values contained in a separate feature layer called “Building Permits.” In that layer, the amount collected for an electric permit is stored in a field called “Electric_Amount.”&lt;BR /&gt;What I would like to do is update a question (called “erw_paid”) in a survey form linked to our Building Inspection layer based on the value of that payment field. If the “Electric_Amount” field contains anything other than “NaN”, I would like to have a question in the Building Inspection form update its value to “Yes.” The layers share a key field called “Permit ID”, so certain values can be retrieved using a “getValue” function.&lt;/P&gt;&lt;P&gt;I’ve been trying to accomplish this using a hidden field populated with a pull function and some logic responding to the value of that field, but the question never updates with the desired value when the form is opened. I’ve tried setting parameters for both to “calculationMode=auto”, but the calculation for the “erw_paid” question never seems to trigger even though it isn’t being held back by a relevant function. I’ve attached an Excel with the relevant lines, but I’ll include short snippets below as well:&lt;/P&gt;&lt;P&gt;Question 1:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Type: Decimal&lt;/LI&gt;&lt;LI&gt;Name: elec_hidden&lt;/LI&gt;&lt;LI&gt;Calculation: pulldata("@layer", "getValue", "attributes.ElectricPermit_Amount", "&lt;A href="https://services6.arcgis.com/cMgmhwu0L5CeOOoS/arcgis/rest/services/Department_of_Community_Development/FeatureServer/2" target="_blank" rel="noopener"&gt;https://services6.arcgis.com/cMgmhwu0L5CeOOoS/arcgis/rest/services/Department_of_Community_Development/FeatureServer/2&lt;/A&gt;", concat("PERMITID='",${permitid},"'"))&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Question 2:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Type: select_one yesno&lt;/LI&gt;&lt;LI&gt;Name: erw_paid&lt;/LI&gt;&lt;LI&gt;Calculation: if(${elec_hidden} != 'NaN', 'yes', 'no')&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Can anyone tell me where I might be going wrong here?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 13:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554224#M59854</guid>
      <dc:creator>Marc_Patti</dc:creator>
      <dc:date>2024-10-31T13:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Calculation Won't Trigger Based On Hidden Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554384#M59868</link>
      <description>&lt;P&gt;I am not sure it will store a NaN in it actually.&amp;nbsp; I would try changing Q1 to string and see what it gives you.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 17:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554384#M59868</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-10-31T17:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Calculation Won't Trigger Based On Hidden Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554426#M59874</link>
      <description>&lt;P&gt;I'm with &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16421"&gt;@DougBrowning&lt;/a&gt;.&amp;nbsp;I don't think NaN will actually be stored.&lt;/P&gt;&lt;P&gt;Dump ${elec_hidden} into a text field and visually confirm what it is actually returning. I've only seen NaN returned as an error. If you &lt;EM&gt;are&lt;/EM&gt; seeing NaN and the calculate still isn't working, I'd tweak the calculate to not return an error (aka, NaN, in this case).&lt;/P&gt;&lt;P&gt;And in case anyone reading this is curious, NaN = Not a number.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 17:45:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554426#M59874</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-10-31T17:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Calculation Won't Trigger Based On Hidden Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554542#M59892</link>
      <description>&lt;P&gt;The field is double, so it will return a result or a null value.&lt;/P&gt;&lt;P&gt;You can wrap the calculation in a function to check if a result has been returned.&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm#ESRI_SECTION1_AD27BB09225C4DBC9C04D0C6877E7A42" target="_blank"&gt;https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm#ESRI_SECTION1_AD27BB09225C4DBC9C04D0C6877E7A42&lt;/A&gt;&lt;/P&gt;&lt;P&gt;boolean(question, expression, or value)&lt;/P&gt;&lt;P&gt;Try having a secondary calculation that checks the result e.g. boolean(${pulldataquestion}) and then act on if that function returns true or false.&lt;/P&gt;&lt;P&gt;Try and leverage the Null / empty functions on the above documentation page instead of trying to interpret NaN as a literal string.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 22:00:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1554542#M59892</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2024-10-31T22:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Calculation Won't Trigger Based On Hidden Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1555391#M59937</link>
      <description>&lt;P&gt;Yep, dumping the result into a non-hidden text field was the right move. Turns out the function was pulling a "null" string, which I wasn't expecting. I re-wrote the function to change the "erw_paid" answer to "Yes" if the new string field did not pull string values of "null", "", or "0.00". It ended up looking like this:&lt;/P&gt;&lt;TABLE width="599"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="599"&gt;if(${elec_hidden} = 'null' or ${elec_hidden} = '' or ${elec_hidden} = '0.00', 'No', 'Yes')&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to all of you for getting me pointed in the right direction!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 13:47:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-calculation-won-t-trigger-based-on/m-p/1555391#M59937</guid>
      <dc:creator>Marc_Patti</dc:creator>
      <dc:date>2024-11-05T13:47:45Z</dc:date>
    </item>
  </channel>
</rss>

