<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to Display a negative value using the dollar() &amp;amp; text() functions?</title><link>https://community.appian.com/discussions/f/general/13349/how-to-display-a-negative-value-using-the-dollar-text-functions</link><description>Hi All, 
 
 I have a requirement to display a negative value with a dollar symbol and text functions but whenever I tried doing it am getting unexpected result. 
 For eg: 
 dollar(10000-30000,0) = &amp;quot; ($20,000) &amp;quot; [but expected is &amp;quot; $20,000 &amp;quot; an extra &amp;quot;</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60599?ContentTypeID=1</link><pubDate>Sat, 22 Sep 2018 09:04:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ee01395d-6e35-4837-860e-f006c4a89d29</guid><dc:creator>rp_balaji</dc:creator><description>Thanks Yeswanth.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60598?ContentTypeID=1</link><pubDate>Sat, 22 Sep 2018 09:03:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ec93d10c-ea90-45dd-bd2c-736e0676f5a1</guid><dc:creator>rp_balaji</dc:creator><description>Thanks Yamuna.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60597?ContentTypeID=1</link><pubDate>Sat, 22 Sep 2018 09:02:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c917d68c-8cc8-46ba-ac5a-2857a7ba3eda</guid><dc:creator>rp_balaji</dc:creator><description>Thanks Venkat.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60596?ContentTypeID=1</link><pubDate>Sat, 22 Sep 2018 09:02:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:691b466d-5936-464d-a10d-0869102fcd92</guid><dc:creator>rp_balaji</dc:creator><description>Thanks Alok.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60595?ContentTypeID=1</link><pubDate>Sat, 22 Sep 2018 09:01:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47a657e7-a3c3-4ba2-980e-3f4c4c043041</guid><dc:creator>rp_balaji</dc:creator><description>Thanks Krishna.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60359?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 13:39:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:537cda98-e8cc-45e0-a1de-6ed8cf24be11</guid><dc:creator>yeswanththiyarir</dc:creator><description>Hi,&lt;br /&gt;
Can you please try this: &lt;br /&gt;
load(&lt;br /&gt;
  local!amount: 10000 - 30000,&lt;br /&gt;
  if( sign(local!amount)=-1,&lt;br /&gt;
    append(&amp;quot;-&amp;quot;,dollar(abs(local!amount))),&lt;br /&gt;
    dollar(abs(local!amount))&lt;br /&gt;
    )&lt;br /&gt;
    )&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60355?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 13:08:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:52bd4a5c-84f0-4e19-8633-25bcf370081f</guid><dc:creator>yamunar0001</dc:creator><description>&lt;p&gt;Hi Balaji,&lt;/p&gt;
&lt;p&gt;I hope this code will help you.&lt;/p&gt;
&lt;p&gt;rule!SPB_LMS_FL_textField(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;label: &amp;quot;Balance&amp;quot;,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;isReadOnly: true(),&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value:if(ri!exitBalance&amp;lt;0,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;concat(&amp;quot;-&amp;quot;,pound(rule!returnPositiveDecimalNumber(ri!exitBalance))),pound(ri!exitBalance))&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/p&gt;
&lt;p&gt;rule!returnPositiveDecimalNumber&lt;/p&gt;
&lt;p&gt;-----------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;if(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;or(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;rule!APN_isEmpty(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ri!decimalNumber&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;),&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;rule!checkIfDecimalNumberPositive(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ri!decimalNumber&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;),&lt;/p&gt;
&lt;p&gt;&amp;nbsp;ri!decimalNumber,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;sqrt(&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;ri!decimalNumber * ri!decimalNumber&lt;/p&gt;
&lt;p&gt;&amp;nbsp;)&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;rule!checkIfDecimalNumberPositive&lt;/p&gt;
&lt;p&gt;-----------------------------------------------------&lt;/p&gt;
&lt;p&gt;if(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;ri!decimalNumber &amp;gt;= 0,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;true(),&lt;/p&gt;
&lt;p&gt;&amp;nbsp;false()&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;Result&lt;/p&gt;
&lt;p&gt;----------&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1537189670939v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1537189670939v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1537189721395v2.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1537189721395v2.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60349?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 11:40:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4a53bf91-0c07-4ca8-8fc7-98f1c8465f9a</guid><dc:creator>vijay</dc:creator><description>Hi &lt;a href="/members/balajir0001"&gt;rp_balaji&lt;/a&gt; ,&lt;br /&gt;
&lt;br /&gt;
In case if you want to go with text function, please find the below code might help.&lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
  local!specifiedFormat: stripwith(&lt;br /&gt;
    tostring(&lt;br /&gt;
      repeat(&lt;br /&gt;
        len(&lt;br /&gt;
          stripwith(&lt;br /&gt;
            10000 - 30000,&lt;br /&gt;
            &amp;quot;-&amp;quot;&lt;br /&gt;
          )&lt;br /&gt;
        ),&lt;br /&gt;
        &amp;quot;0&amp;quot;&lt;br /&gt;
      )&lt;br /&gt;
    ),&lt;br /&gt;
    &amp;quot;; &amp;quot;&lt;br /&gt;
  ),&lt;br /&gt;
  text(&lt;br /&gt;
    10000 - 30000,&lt;br /&gt;
    concat(&lt;br /&gt;
      &amp;quot;$&amp;quot;,&lt;br /&gt;
      local!specifiedFormat,&lt;br /&gt;
      &amp;quot;;#&amp;quot;,&lt;br /&gt;
      local!specifiedFormat&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Vijay&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60343?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 10:42:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:29261989-5612-49e3-8e88-47d150047405</guid><dc:creator>aloks0189</dc:creator><description>&lt;p&gt;Hi rpbalaji2006 (balajir0001) there are multiple ways to achieve this requirement, hence please find the code snippet to achieve your requirement, mentioned below:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* FOR dollar() related requirement */

/* Using Regex Pattern - using Appian Regular Expression Functions plugin */
regexreplaceall(
  &amp;quot;[()]&amp;quot;,
  dollar(10000 - 30000, 0),
  &amp;quot;&amp;quot;
)
/* OUTPUT: &amp;quot;$20,000&amp;quot; */


/* Achieving the same using String Manipulation - without plugin */
load(
  local!amount: dollar(10000 - 30000, 0),
  if(
    isnull(local!amount),
    dollar(0),
    replace(
      replace(local!amount, 1, 1, &amp;quot;&amp;quot;), 
      len(replace(local!amount, 1, 1, &amp;quot;&amp;quot;)),
      1, 
      &amp;quot;&amp;quot;
    )
  )
)
/* OUTPUT: &amp;quot;$20,000&amp;quot; */


/* For text() requirement */
/* As you are already aware, when you subtract more amount from lesser one, you should expect negative value as it&amp;#39;s result */

Approach 1:  10000-30000    /* OUTPUT: 	-20000  Type: Number (Integer) */
Approach 2:  tostring(10000-30000) /* OUTPUT: &amp;quot;-20000&amp;quot;  Type: Text */

/* You don&amp;#39;t need to use text function to achieve this requirement, you can simply use one of the above approach depending upon what return type you are expecting */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hope this will help you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Display a negative value using the dollar() &amp; text() functions?</title><link>https://community.appian.com/thread/60338?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 09:39:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:081f77ed-3364-4485-8f76-5be00b70fe5c</guid><dc:creator>Krishna Chaitanya</dc:creator><description>&lt;p&gt;Hi ,&lt;br /&gt; use below code &lt;br /&gt; &lt;br /&gt;1)&lt;/p&gt;
&lt;p&gt;stripwith(&lt;br /&gt;&amp;nbsp;if(&lt;br /&gt; sign(&lt;br /&gt; 10000-30000&lt;br /&gt; )&amp;lt;0 ,&lt;br /&gt; append(&lt;br /&gt; &amp;quot;-&amp;quot;,&lt;br /&gt; dollar(&lt;br /&gt; 10000-30000&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; dollar(&lt;br /&gt; 10000-30000&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;()&amp;quot;&lt;br /&gt; )&amp;nbsp;&lt;/p&gt;
&lt;p&gt;result : &amp;quot;-$20,000.00&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;dollar(abs(10000-30000))&amp;nbsp; &amp;nbsp;result : &amp;quot;$20,000.00&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;text(&lt;br /&gt; 10000-30000,&lt;br /&gt; &amp;quot;###,###;-###,###&amp;quot;&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;result : &amp;quot;-20,000&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>