<?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>Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/3632/why-does-this-cause-my-instance-of-sugar-to-crash</link><description>The formula saves without any errors. But when I save the field I get an error that crashed my instance. It&amp;#39;s on demand, not on my server. This is my little formula. All the fields are correct and the syntax appears to be fine too. It looks worse han</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18291?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 11:28:18 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:ae22f2f9-eeb1-4dc2-aa7b-b12ac29dfdc1</guid><dc:creator>Howard Jennings</dc:creator><description>&lt;p&gt;Hi Patrick&lt;/p&gt;&lt;p&gt;Just though I&amp;#39;d let you know I&amp;#39;ve resolved this and now have two solutions.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;I&amp;#39;ve split the formula in to 16 elements 2 for each &amp;#39;Program&amp;#39; being &amp;#39;Hazard&amp;#39; &amp;amp; &amp;#39;GL&amp;#39; each returns &amp;quot;&amp;quot; if it&amp;#39;s not the correct program. I then have a field that collects the calculated result from the correct block above. this works well with no delays &lt;span class="emoticon_happy emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Using the Sugar API and Integromat (integromat.com worth a look) Using this I am able to collect all the data from Sugar and perform just the calculation I need, without nested IF&amp;#39;s. I have a field in Sugar called [field_name] which builds the name of the field to use in the calculation, based on the options selected. Once passed to Integromat, Integromat finds the field, does the calculation and puts the result back in the Sugar record.&lt;/li&gt;&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18292?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 18:17:21 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:ce7c27c3-ca86-4008-afcc-3f7a6dd6c517</guid><dc:creator>Howard Jennings</dc:creator><description>&lt;p&gt;I&amp;#39;ve solved this by have individual calculations for each program number starting with an ifElse(equal(Program_number, pX)) if true, it calculate, if false, it returns &amp;quot;&amp;quot;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I then have another field that pulls the result.&lt;/p&gt;&lt;p&gt;This has been running fine for a few weeks without any problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18290?ContentTypeID=1</link><pubDate>Fri, 17 Jul 2020 07:53:06 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:888b5337-66b7-4a8d-a19b-116a2102228b</guid><dc:creator>Howard Jennings</dc:creator><description>&lt;p&gt;Hi Patrick.&amp;nbsp;&lt;/p&gt;&lt;p&gt;As I have to also determin if it&amp;#39;s occupied or vacant, would the formula in &amp;quot;$px_c&amp;quot; actually need to be like this:&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($property_status_c,&amp;quot;Occupied&amp;quot;),&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Com&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_com_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;0)))))))),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Res&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_res_occ_t_c&amp;quot;),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;0)))))))),&lt;/span&gt;&lt;br style="color:#000000;background-color:#f6f6f6;" /&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;0))&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;&lt;span&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Com&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_com_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;0)))))))),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Res&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_res_vac_t_c&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;0)))))))),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;0))&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong style="background-color:#f6f6f6;color:#000000;"&gt;HAZARD PREMIUM FIELD&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;background-color:#f6f6f6;"&gt;&lt;span&gt;Then once I have the correct rate field the acutal calculation of the cost is&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;divide(add(Multiply($sum_insured_c,px_c),$add_windstorm_cost_c),$premium_freq_c)&lt;/p&gt;&lt;p&gt;&lt;em&gt;$premium_freq_c returns 1 if &amp;quot;annual&amp;quot; is selected and 12 if &amp;quot;monthly&amp;quot; is selected.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;I can use the same calculation for every program, even if here is no &amp;quot;add_windstorm_cost&amp;quot;, as it would just add zero&lt;/p&gt;&lt;p&gt;The big job is getting the correct rate field to use in the calculation. it&amp;#39;s all those IF&amp;#39;s that are causing speed issues. Particularly as I need almost exactly the same again to&amp;nbsp;correct field to calculate the GL cost.&lt;/p&gt;&lt;p&gt;Would I be better doing this externally and updating the record using the API or with a custom module?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18289?ContentTypeID=1</link><pubDate>Fri, 17 Jul 2020 00:47:59 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d5848e62-2191-4ded-9fa6-f405ec005b88</guid><dc:creator>Patrick McQueen</dc:creator><description>&lt;p&gt;Hi Howard,&lt;/p&gt;&lt;p&gt;What do you think of having a field that pulls in the appropriate related($r_rates_bi_buildings_insurance_1,&amp;quot;px_xxx_occ_t_c&amp;quot;) from the Rate record?&lt;/p&gt;&lt;p&gt;For example: &lt;br /&gt;Create a field in your BI module (let&amp;#39;s call it &amp;quot;px_c&amp;quot; for the sake of this discussion), and populate it with a formula like this:&lt;/p&gt;&lt;blockquote class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;p&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Com&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_com_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_com_occ_t_c&amp;quot;),&lt;br /&gt;0)))))))),&lt;br /&gt;ifElse(equal(subStr($property_type_c,0,3),&amp;quot;Res&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;1&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p1_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;2&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p2_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;3&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p3_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;4&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p4_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;5&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p5_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;6&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p6_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;7&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p7_res_occ_t_c&amp;quot;),&lt;br /&gt;ifElse(equal($bi_program_no_c,&amp;quot;8&amp;quot;),related($r_rates_bi_buildings_insurance_1,&amp;quot;p8_res_occ_t_c&amp;quot;),&lt;br /&gt;0)))))))),&lt;br /&gt;0))&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Then, in test_hazard_premium_c, you could calculate with this:&lt;/p&gt;&lt;blockquote class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;p&gt;ifElse(equal($policy_status_c,&amp;quot;Cancelled&amp;quot;),&amp;quot;0.00&amp;quot;,&lt;br /&gt;ifElse(equal($occ_status_c,&amp;quot;Occupied&amp;quot;),&lt;br /&gt;ifElse(isInList($bi_program_no_c,createList(1,3)),&lt;br /&gt;ifElse(equal($premium_freq_c,&amp;quot;Annual&amp;quot;),&lt;br /&gt;currencyMultiply($sum_insured_c,$px_c),divide(currencyMultiply($sum_insured_c,$px_c),12)),&lt;br /&gt;ifElse(isInList($bi_program_no_c,createList(2,4,5,6,7,8)),&lt;br /&gt;ifElse(equal($premium_freq_c,&amp;quot;Annual&amp;quot;),&lt;br /&gt;add(currencyMultiply($sum_insured_c,$px_c),$add_windstorm_cost_c),add(divide(currencyMultiply($sum_insured_c,$px_c),12),$add_windstorm_cost_c)),&lt;br /&gt;0)),0))&lt;/p&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18288?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2020 06:14:41 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:6d7dce70-76a5-4118-86cc-d019df1d44b5</guid><dc:creator>Howard Jennings</dc:creator><description>&lt;p&gt;Hi @&lt;strong style="color:#000000;background-color:#ffffff;border:0px;font-weight:bold;font-size:12.6px;"&gt;&lt;a href="https://sugarclub.sugarcrm.com/members/pmcqueen" style="color:#009cde;border:0px;font-weight:inherit;text-decoration:none;font-size:1.1em;padding:0px 3px 0px 0px;"&gt;Patrick McQueen&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m not sure how this helps &lt;span class="emoticon_sad emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;My formula calculates an insurance premium and is basically&lt;/p&gt;&lt;p&gt;MULTIPLY([sum-insured],[rate]) but [rate] has variables.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Occupied [occ] or Vacant [vac]&lt;/li&gt;&lt;li&gt;Property type = Residential [res] or Commercial [com]&lt;/li&gt;&lt;li&gt;Program number = [p1], [p2], [p3] currently there are 8 programs&lt;/li&gt;&lt;li&gt;Premium frequency = Annually [1] or Monthly [12]&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;My logic runs&lt;/p&gt;&lt;p&gt;IF is it [occ],&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;then the [com] and premium frequency for each program number. then the same for [res]&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;then the same for [res]&lt;/p&gt;&lt;p&gt;ELSE&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exactly as above only [vac]&lt;/p&gt;&lt;p&gt;I need to find a way of dynamically building the formula. Something like&lt;/p&gt;&lt;p&gt;&lt;strong&gt;field names&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;My rate fields are named pX_res_occ_t_c or pX_com_occ_t_c etc.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;p1_res_occ_t_c = 0.0043&lt;/p&gt;&lt;p&gt;sum_ins = 25000 (but could be any amount)&lt;/p&gt;&lt;p&gt;occupancy status = _occ or _vac&lt;/p&gt;&lt;p&gt;property_type = _res or _com&lt;/p&gt;&lt;p&gt;program_no = p1 or p2, or p3 etc.&lt;/p&gt;&lt;p&gt;premium_freq = 1 or 12&lt;/p&gt;&lt;p&gt;&lt;strong&gt;formula&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;var occ =&amp;nbsp;&lt;span&gt;occupancy status&lt;/span&gt;&lt;/p&gt;&lt;p&gt;var type =&amp;nbsp;&lt;span&gt;property_type&lt;/span&gt;&lt;/p&gt;&lt;p&gt;var prog =&amp;nbsp;&lt;span&gt;program_no&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;var freq =&amp;nbsp;&lt;span&gt;premium_freq&lt;/span&gt;&lt;/p&gt;&lt;p&gt;var field_name = CONCAT(prog,type,occ,&amp;quot;_t_c&amp;quot;) // &lt;em&gt;This would build a legitimate field name i.e. p1_res_occ_t_c which could then be used to calculate the premium.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;DIVIDE(MULTIPLY([sum_ins],[field_name],freq) or 25000 X 0.0043 / 1 = 107.50&lt;/p&gt;&lt;p&gt;That would remove most of my IfElse statements and make it much leaner. I know I&amp;#39;m mixing languages, but that&amp;#39;s the beauty of only having enough knowledge to be dangerous &lt;span class="emoticon_happy emoticon-inline" style="height:16px;width:16px;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why does this cause my instance of Sugar to crash?</title><link>https://sugarclub.sugarcrm.com/thread/18287?ContentTypeID=1</link><pubDate>Thu, 02 Jul 2020 17:10:21 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:82ba2bcd-6ba1-42b1-9d02-ac6e579b597d</guid><dc:creator>Patrick McQueen</dc:creator><description>&lt;p&gt;Hi Howard,&lt;/p&gt;&lt;p&gt;It looks like you are writing a switch, and a rather complex one, in a feature that was intended to handle trivial data manipulation. I recommend a different approach to your use case.&lt;/p&gt;&lt;p&gt;For the aspects of this logic where you have &amp;quot;If value a, then b. If value c, then d, etc...&amp;quot; I would make a dropdown list in which the Item Name is the &amp;quot;if&amp;quot; value, and the Display Label is the &amp;quot;then&amp;quot; value, and then replace all of the embedded ifElse logic with a simpler &amp;quot;where Item Name, then Display Label&amp;quot; kind of calculation. &lt;a href="https://sugarclub.sugarcrm.com/members/rifa"&gt;Chris Raffle&lt;/a&gt; posts a great example of this idea &lt;a href="https://sugarclub.sugarcrm.com/explore/enterprise-professional/f/enterprise-professional-questions/3019/how-to-create-a-field-that-returns-a-specified-value-based-on-a-related-field-in-sugar-crm"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I hope this was helpful!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>