<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.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>Calculated field for If/then statement</title><link>https://sugarclub.sugarcrm.com/explore/help-forums/enterprise-professional/f/enterprise-professional-questions/5808/calculated-field-for-if-then-statement</link><description>I am trying to figure out how to create a percentage paid field that will display the current most paid stage payment. i.e. 
 if the client has paid 10% percent only it will display 10 or 10% 
 If the client has paid 40% and 10% it will display 40 or</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Calculated field for If/then statement</title><link>https://sugarclub.sugarcrm.com/thread/27133?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 07:23:04 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d5c7566b-a071-4cbc-a23d-f398fe8d7b5f</guid><dc:creator>Bj&amp;#246;rn Canales Pfisterer</dc:creator><description>&lt;p&gt;I recommend to add a check for avoiding division by zero errors, especially when this kind of formulas is introduced later on and you are having empty fields in records ;-)&lt;/p&gt;
&lt;p&gt;ifElse(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;or(equal($paid_amount,0),equal($paid_amount,&amp;quot;&amp;quot;)),&amp;quot;0&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;concat(toString(divide(multiply($paid_amount,100),$total_amount)), 2)))&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Bests&lt;/p&gt;
&lt;p&gt;Bj&amp;ouml;rn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculated field for If/then statement</title><link>https://sugarclub.sugarcrm.com/thread/27115?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 15:32:28 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:cafe99b5-91f1-4c38-9346-025bcf132432</guid><dc:creator>Chris Raffle</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/pennywhitlock328650"&gt;Penny Whitlock&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Can you clarify how you are tracking the staged payments and what module you are looking to display the highest paid percentage amount? Do you have a specific field tracking the percentage paid of a given payment or is that also a mathematical calculation you need to perform?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculated field for If/then statement</title><link>https://sugarclub.sugarcrm.com/thread/27111?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 12:57:12 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:3c08cc1d-e0c1-47cc-9f13-0efb8360bbee</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Good morning Penny,&lt;/p&gt;
&lt;p&gt;You could just do the math in your formula. I assume you have the total_amount and paid_amount.&lt;/p&gt;
&lt;p&gt;so your percentage paid = paid_amount * 100 / total_amount&lt;/p&gt;
&lt;p&gt;To get the decimal:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;divide(multiply($paid_amount,100),$total_amount)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;you&amp;nbsp;will likely want to round round that, for example to 2 decimals:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;round(divide(multiply($paid_amount,100),$total_amount), 2)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To get it as a string field with the % sign, you can&amp;nbsp;turn it into a string&lt;/p&gt;
&lt;p&gt;toString(&lt;span&gt;divide(multiply($paid_amount,100),$total_amount)&lt;/span&gt;&lt;span&gt;, 2))&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and concatenate the % sign&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;concat(toString(divide(multiply($paid_amount,100),$total_amount)), 2)))&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Test this because it&amp;#39;s off the top of my head and I didn&amp;#39;t verify the syntax&amp;nbsp;&lt;span class="emoticon" data-url="https://sugarclub.sugarcrm.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;FrancescaS&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>