<?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: Survey123 Custom Print Template - Formatting decimal places in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778268#M5535</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help. I'll have to see if this will be feasible to add to my existing survey. And see if this can help for our contract sign up next year. I appreciate it!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Nov 2018 15:01:54 GMT</pubDate>
    <dc:creator>TrishaSchlake</dc:creator>
    <dc:date>2018-11-06T15:01:54Z</dc:date>
    <item>
      <title>Survey123 Custom Print Template - Formatting decimal places</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778266#M5533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to format the Survey123 Custom Print Template to round decimal places to two decimal places? My survey form is currently collecting&amp;nbsp;values by using round(${TotalPayment},2), but when I go to use my custom print template that I created it doesn't keep this formatting. It seems to drop a 0. For my attached example my total payment is $65.60, but right now when I generate my custom print template it puts $65.6, dropping that 0 at the end.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice that for my dollar figures in my custom print template, would keep the two decimal places that I am collecting in my form or have a way to format it in the custom print template.&amp;nbsp; Thank you for your help.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:39:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778266#M5533</guid>
      <dc:creator>TrishaSchlake</dc:creator>
      <dc:date>2018-11-02T14:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Custom Print Template - Formatting decimal places</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778267#M5534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;STRONG&gt;&lt;EM&gt;Edit: This is for a new survey, rather than an existing survey. Not sure if there's a workaround for an existing survey.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The round() function automatically drops the 0. I don't think there's a way to change that, but if you convert the number to a string there are some&amp;nbsp;ways you could format it the way you want, then display that string in the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't come across an easy way to do this with the functions available, but I came up with a way that has worked for me. My logic:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Round the decimal number to 2 decimal places.&lt;/LI&gt;&lt;LI&gt;Convert the decimal number to an integer.&lt;/LI&gt;&lt;LI&gt;Calculate the length of the rounded decimal number and the integer.&lt;/LI&gt;&lt;LI&gt;Calculate the difference between the length of the rounded decimal number and the integer.&lt;UL&gt;&lt;LI&gt;If there are 2 decimal places in the rounded decimal number, it should be 3 characters longer than the integer (decimal and the two numbers, e.g. 125.65 vs 126).&lt;/LI&gt;&lt;LI&gt;If there is 1 decimal place in the rounded decimal number, it should be 2 characters longer than the integer (decimal and one number, e.g. 125.6 vs 126).&lt;/LI&gt;&lt;LI&gt;If there are 0 decimal places in the rounded decimal number, it should be the same length as the integer.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;If the length difference is 2, that indicates that there is only one number after the decimal in the rounded decimal number. Assuming this means that a 0 was dropped, add the 0 back to the end of the string. If the length difference is not 2, don't add anything to the end of the string.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fields in my example XLSForm spreadsheet:&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef; height: 25px;"&gt;&lt;TH style="height: 25px; width: 6%;"&gt;type&lt;/TH&gt;&lt;TH style="height: 25px; width: 10%;"&gt;name&lt;/TH&gt;&lt;TH style="height: 25px; width: 13.0393%;"&gt;label&lt;/TH&gt;&lt;TH style="height: 25px; width: 49.9607%;"&gt;calculation&lt;/TH&gt;&lt;TH style="height: 25px; width: 11%;"&gt;bind::esri:fieldType&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;decimal&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;input&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Input&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;total&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Total&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;${input}*5&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;tot_rounded&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Rounded total&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;round(${total},2)&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;tot_as_int&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Total as integer&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;int(${total})&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;len_tot_rounded&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Length of rounded total&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;string-length(${tot_rounded})&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;len_tot_as_int&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Length of total as integer&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;string-length(${tot_as_int})&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;len_diff&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Length difference&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;${len_tot_rounded} - ${len_tot_as_int}&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;null&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="height: 25px; width: 6%;"&gt;calculate&lt;/TD&gt;&lt;TD style="height: 25px; width: 10%;"&gt;tot_as_text&lt;/TD&gt;&lt;TD style="height: 25px; width: 13.0393%;"&gt;Total as text&lt;/TD&gt;&lt;TD style="height: 25px; width: 49.9607%;"&gt;if(${len_diff}=2, concat('$',${tot_rounded},'0'), concat('$',${tot_rounded}))&lt;/TD&gt;&lt;TD style="height: 25px; width: 11%;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, you could then display ${tot_as_text} in the report rather than the rounded total as calculated by the round() function. The attached image shows the table from this example survey after a few submissions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2018 20:10:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778267#M5534</guid>
      <dc:creator>StephenM</dc:creator>
      <dc:date>2018-11-02T20:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Custom Print Template - Formatting decimal places</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778268#M5535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help. I'll have to see if this will be feasible to add to my existing survey. And see if this can help for our contract sign up next year. I appreciate it!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2018 15:01:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-custom-print-template-formatting-decimal/m-p/778268#M5535</guid>
      <dc:creator>TrishaSchlake</dc:creator>
      <dc:date>2018-11-06T15:01:54Z</dc:date>
    </item>
  </channel>
</rss>

