<?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 Re: Create constraints based on previous answers in survey. in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041775#M33490</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/81824"&gt;@PatrickMcGarry1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;See attached xlsf with a sample on how to achieve that (sample is for 7 days).&lt;/P&gt;&lt;P&gt;First you need to get the number of days as an integer. You can set this up in your choices or create another hidden field, let’s call it &lt;I&gt;number_of_days&lt;/I&gt; to return an integer by using an &lt;I&gt;if&lt;/I&gt; statement, for example&amp;nbsp;&lt;EM&gt;if(selected(${priority_code},"P1 - 24HRS", 1, if(selected(${priority_code},"P2 – 1WEEK",7, etc.).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Now that you have the days you can create a calculate field and calculate it as&lt;/P&gt;&lt;P&gt;&lt;EM&gt;date(decimal-date-time(today()) +int(${&lt;/EM&gt;&lt;I&gt;number_of_days})&lt;EM&gt;)&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;EM&gt;or&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;EM&gt;date(decimal-date-time(now()) +int(${number_of_days}))&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Then put a constraint on your completion date field forcing it to be equal or bigger than the calculated field.&lt;/P&gt;&lt;P&gt;Hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 01:39:20 GMT</pubDate>
    <dc:creator>UriGilad_EsriAu</dc:creator>
    <dc:date>2021-03-30T01:39:20Z</dc:date>
    <item>
      <title>Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041508#M33464</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PatrickMcGarry1_0-1617024161827.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/9554i74FB9720D241822A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PatrickMcGarry1_0-1617024161827.png" alt="PatrickMcGarry1_0-1617024161827.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In Survey 123, I am trying to create a survey answer based on the results of previous answers. For example in the image above, a users chooses the priority level and then the day the defect was reported on. The Due Date for completion has to to be limited to 24HRS/1 Week etc from the defect date based on the responses given. I have tried constraints and calculations on Survey 123 connect, but connect get a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 13:29:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041508#M33464</guid>
      <dc:creator>PatrickMcGarry1</dc:creator>
      <dc:date>2021-03-29T13:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041775#M33490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/81824"&gt;@PatrickMcGarry1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;See attached xlsf with a sample on how to achieve that (sample is for 7 days).&lt;/P&gt;&lt;P&gt;First you need to get the number of days as an integer. You can set this up in your choices or create another hidden field, let’s call it &lt;I&gt;number_of_days&lt;/I&gt; to return an integer by using an &lt;I&gt;if&lt;/I&gt; statement, for example&amp;nbsp;&lt;EM&gt;if(selected(${priority_code},"P1 - 24HRS", 1, if(selected(${priority_code},"P2 – 1WEEK",7, etc.).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Now that you have the days you can create a calculate field and calculate it as&lt;/P&gt;&lt;P&gt;&lt;EM&gt;date(decimal-date-time(today()) +int(${&lt;/EM&gt;&lt;I&gt;number_of_days})&lt;EM&gt;)&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;EM&gt;or&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;EM&gt;date(decimal-date-time(now()) +int(${number_of_days}))&amp;nbsp;&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Then put a constraint on your completion date field forcing it to be equal or bigger than the calculated field.&lt;/P&gt;&lt;P&gt;Hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 01:39:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041775#M33490</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2021-03-30T01:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041878#M33495</link>
      <description>&lt;P&gt;Thanks Uri,&lt;/P&gt;&lt;P&gt;I tried updating the XLS form, but it doesn't seem to be accepting the constraints. In the form attached, I have limited the date to one day from today but when I add the due date, it doesn't accept it as valid. Not sure if I am doing this correctly. Any ideas?&lt;/P&gt;&lt;P&gt;Thanks, Patrick.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PWAY_Defects.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/9640i14BB6657E49D44EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="PWAY_Defects.JPG" alt="PWAY_Defects.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 10:16:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1041878#M33495</guid>
      <dc:creator>PatrickMcGarry1</dc:creator>
      <dc:date>2021-03-30T10:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1042251#M33532</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/81824"&gt;@PatrickMcGarry1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Just had to shuffle a few lines - see attached xlsf with corrected fields.&amp;nbsp;&lt;/SPAN&gt;Note that currently 'P4 Routine Maintenance' = 100 days. Change it in the calculation field to fit the number of days you're after.&lt;/P&gt;&lt;P&gt;Also, consider changing the constraints error messages of the date to something that will explain the reason of error, e.g., 'Completion date must be in 7 days'.&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 01:03:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1042251#M33532</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2021-03-31T01:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1042817#M33577</link>
      <description>&lt;P&gt;Thanks a lot Uri that worked. I also tried changing the choices to integers and that worked also without the need for the number of days calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I also default to the date for the Due Date for Completion. For example, if I select the Priority Code for P1 - 24HRS can this automate the due date for Completion to be 1 day from the Date the Defect was Reported on? I want the due date to be autocompleted based on the Priority Code and the Reported Date.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 11:09:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1042817#M33577</guid>
      <dc:creator>PatrickMcGarry1</dc:creator>
      <dc:date>2021-04-01T11:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create constraints based on previous answers in survey.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1044532#M33686</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/81824"&gt;@PatrickMcGarry1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Yes, all you need to do is replace&lt;/P&gt;&lt;P&gt;&lt;EM&gt;date(decimal-date-time(today())+int(${number_of_days}))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;date(decimal-date-time(${date_the_defect_was_reported_on})+int(${number_of_days}))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Note that this solution doesn't work well on the web version, but seems to work fine on the Survey123 app.&lt;/P&gt;&lt;P&gt;Cheers,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 05:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/create-constraints-based-on-previous-answers-in/m-p/1044532#M33686</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2021-04-07T05:59:48Z</dc:date>
    </item>
  </channel>
</rss>

