<?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: Nested If/Then statements for Instance Name in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1181351#M43166</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/286635"&gt;@GaryBowles1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Are you able to share the XLSForm (xlsx file and any media/scripts) and instructions on which questions to fill out to make the instance name work in each case.&lt;/P&gt;&lt;P&gt;I need to look into it further with your exact survey, as if you set up a simple instance name with if() statements it is working.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Phil.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 03:59:25 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2022-06-09T03:59:25Z</dc:date>
    <item>
      <title>Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1179885#M43035</link>
      <description>&lt;H5&gt;I am trying to use nested if statements to color code the instance name in the Inbox. I have 4 cases that I need to check for:&lt;/H5&gt;&lt;H5&gt;CASE 1 -&amp;nbsp;No Leak&lt;/H5&gt;&lt;P&gt;If(string-length(${leak_id} = 0),&amp;nbsp;concat('&amp;lt;font color="green"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, '&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), '')&lt;/P&gt;&lt;P&gt;CASE 2 - Leak Found and Not Repaired&lt;/P&gt;&lt;P&gt;If(string-length(${leak_id} &amp;gt; 0) and string-length(${leak_repair_date}=0), concat('&amp;lt;font color="red"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS REPAIR’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), '')&lt;/P&gt;&lt;P&gt;CASE 3 - Leak Repaired and Not Re-Checked&lt;/P&gt;&lt;P&gt;If(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date}&amp;gt;0) and string-length(leak_recheck_date}=0), concat('&amp;lt;font color="orange"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS RE-CHECK’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), '')&lt;/P&gt;&lt;P&gt;CASE 4 - Leak Repaired and Re-Checked&lt;/P&gt;&lt;P&gt;If(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date}&amp;gt;0) and string-length(leak_recheck_date}&amp;gt;0), concat('&amp;lt;font color="blue"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – LEAK REPAIRED &amp;amp; RE-CHECKED’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'),'')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, putting this all together gives me:&lt;/P&gt;&lt;P&gt;If(string-length(${leak_id}=0) , concat('&amp;lt;font color="green"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, '&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), If(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} =0), concat('&amp;lt;font color="red"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS REPAIR’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), If(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} &amp;gt;0) and string-length(leak_recheck_date=0), concat('&amp;lt;font color="orange"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS RE-CHECK’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'), If(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} &amp;gt;0) and string-length(leak_recheck_date}&amp;gt;0) ,concat('&amp;lt;font color="blue"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – LEAK REPAIRED &amp;amp; RE-CHECKED’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;', ‘’)))))&lt;/P&gt;&lt;P&gt;Can I use nested if/then for instance name and if yes, what am I missing??&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--gary&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 18:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1179885#M43035</guid>
      <dc:creator>GaryBowles1</dc:creator>
      <dc:date>2022-06-03T18:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1180104#M43044</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/286635"&gt;@GaryBowles1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Yes, nested if() statements work for instance name.&lt;/P&gt;&lt;P&gt;It looks like you have the closing bracket for the last if() statement in the wrong place for the false condition. In you singular example after the &amp;lt;/font&amp;gt; there is a closing bracket, followed by the '' for final false condition. In your combined if() statements, there is no closing bracket after &amp;lt;/font&amp;gt; meaning the '' are within the concat and there is no false condition for the final nested if().&lt;/P&gt;&lt;P&gt;I have not tested this but it should work (I also find it easier to break the if() statements out onto different lines for each condition, you&amp;nbsp; can then move them all back onto one line when put back into XLSForm):&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if(string-length(${leak_id}=0),
	concat('&amp;lt;font color="green"&amp;gt;&amp;lt;b&amp;gt;',${location_name},'&amp;lt;/b&amp;gt;','&amp;lt;/font&amp;gt;'),
		if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} =0),
			concat('&amp;lt;font color="red"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS REPAIR’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'),
				if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} &amp;gt;0) and string-length(leak_recheck_date=0),
					concat('&amp;lt;font color="orange"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – NEEDS RE-CHECK’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'),
						if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date} &amp;gt;0) and string-length(leak_recheck_date}&amp;gt;0),
							concat('&amp;lt;font color="blue"&amp;gt;&amp;lt;b&amp;gt;', ${location_name}, ‘ – LEAK REPAIRED &amp;amp; RE-CHECKED’,'&amp;lt;/b&amp;gt;', '&amp;lt;/font&amp;gt;'),
						'')
				)
		)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Phil.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 02:10:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1180104#M43044</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-06T02:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1180642#M43097</link>
      <description>&lt;P&gt;Phil,&lt;/P&gt;&lt;P&gt;Thanks for the help, I got the statement to convert in Connect:&lt;/P&gt;&lt;P&gt;if(string-length(${leak_id}=0), concat('&amp;lt;div style="font-weight:bold;color:green"&amp;gt;',${location_name},' - NO LEAKS','&amp;lt;/div&amp;gt;'), if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date}=0), concat('&amp;lt;div style="font-weight:bold;color:red"&amp;gt;', ${location_name}, ‘ – NEEDS REPAIR’,'&amp;lt;/div&amp;gt;'), if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date}&amp;gt;0) and string-length(${leak_recheck_date}=0), concat('&amp;lt;div style="font-weight:bold;color:orange"&amp;gt;', ${location_name}, ‘ – NEEDS RE-CHECK’,'&amp;lt;/div&amp;gt;'), if(string-length(${leak_id}&amp;gt;0) and string-length(${leak_repair_date}&amp;gt;0) and string-length(${leak_recheck_date}&amp;gt;0), concat('&amp;lt;div style="font-weight:bold;color:blue"&amp;gt;', ${location_name}, ‘ – LEAK REPAIRED &amp;amp; RE-CHECKED’,'&amp;lt;/div&amp;gt;'), ''))))&lt;/P&gt;&lt;P&gt;however it does not appear to be working:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GaryBowles1_0-1654615174334.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42899iFB079D27A37BD07F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GaryBowles1_0-1654615174334.png" alt="GaryBowles1_0-1654615174334.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There are 3 of the conditions in the nested if statement within the 4 surveys that are submitted.&lt;/P&gt;&lt;P&gt;Suggestions?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--gary&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 15:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1180642#M43097</guid>
      <dc:creator>GaryBowles1</dc:creator>
      <dc:date>2022-06-07T15:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1181351#M43166</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/286635"&gt;@GaryBowles1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Are you able to share the XLSForm (xlsx file and any media/scripts) and instructions on which questions to fill out to make the instance name work in each case.&lt;/P&gt;&lt;P&gt;I need to look into it further with your exact survey, as if you set up a simple instance name with if() statements it is working.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Phil.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 03:59:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1181351#M43166</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-09T03:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1181463#M43176</link>
      <description>&lt;P&gt;Phil,&lt;/P&gt;&lt;P&gt;Attached is the survey form and .csv file associated with barcode scan. I have been able to get this to work by using the boolean() and not(boolean()) functions instead of string-length(). I have also found that the html formatting (&amp;lt;div style&amp;gt;) as stated here:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-quick-guide-to/ba-p/1101322" target="_blank"&gt;https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-quick-guide-to/ba-p/1101322&lt;/A&gt;&lt;/P&gt;&lt;P&gt;doesn't work and I have to use old reliable&amp;nbsp;&amp;lt;font color="blue"&amp;gt;&amp;lt;b&amp;gt; html formatting.&lt;/P&gt;&lt;P&gt;This is all being done to differentiate surveys in the Inbox. It would be great if we could set up multiple Inboxes instead. I have added this to the Ideas section.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--gary&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 15:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1181463#M43176</guid>
      <dc:creator>GaryBowles1</dc:creator>
      <dc:date>2022-06-09T15:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1477104#M57042</link>
      <description>&lt;P&gt;Did you figure out how to get your whole statement working? I am having a similar issue where only part of the statement executes in the Inbox.&lt;/P&gt;&lt;P&gt;I see that there is a 3-line limit to the instance_name cell in XLS forms. My expression is on a single line. Do we know if there is also a character limit that will be read and executed in XLS? Such as 255?&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 16:57:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1477104#M57042</guid>
      <dc:creator>JoeBryant1</dc:creator>
      <dc:date>2024-05-22T16:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Nested If/Then statements for Instance Name</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1477140#M57043</link>
      <description>&lt;P&gt;Update - I've fixed my issue and verified that there is NOT a 255 character limit for the instance_name cell.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-then-statements-for-instance-name/m-p/1477140#M57043</guid>
      <dc:creator>JoeBryant1</dc:creator>
      <dc:date>2024-05-22T17:49:58Z</dc:date>
    </item>
  </channel>
</rss>

