<?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>Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/discussions/f/rules/19972/most-efficient-way-to-convert-all-numbers-in-an-array-of-dictionary-to-text</link><description>I have a case where I am getting an array of dictionary, and some of the items in the array are decimals that are in scientific notation. For example, I get 3.396929e+14 instead of 339692900000000. What would be the most efficient way to convert all numbers</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/79319?ContentTypeID=1</link><pubDate>Wed, 03 Feb 2021 06:46:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12ee14d6-d428-40a4-b7b5-5b380b46264b</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I just moved to another company and have a new account so I cannot modify older posts anymore. Please contact Appian support at support@appian.com.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/79318?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 23:45:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d220ba62-1d0d-4059-9a86-ce93ae6166fb</guid><dc:creator>walkers0001</dc:creator><description>&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78135?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 20:12:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0fce49ee-7c48-4f3d-a0a3-c278593c7541</guid><dc:creator>Stefan Helzle</dc:creator><description>[deleted]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78134?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 18:33:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c89001d3-bc9a-40b5-ab5f-9282a21eff3a</guid><dc:creator>walkers0001</dc:creator><description>&lt;p&gt;&lt;a href="/members/stefanh791"&gt;Stefan Helzle&lt;/a&gt;thanks for this, it looks good and performs about the same as my original version.&amp;nbsp; Now I am running into a different issue, and I am wondering if you have any ideas, or know why it is happening.&amp;nbsp; There are a few places where I need to sort the resulting list of dictionary by different fields in the dictionary.&amp;nbsp; Unfortunately, after I apply either your or my versions of the code to switch the format of the numbers, I get an error.&amp;nbsp; I have included two scenarios to showcase this:&lt;br /&gt;&lt;br /&gt;Scenario 1: Original data, no error&lt;br /&gt;The thing that is confusing me, is that the Type for both the the original data, and the data after running the number formatting code (either your version or mine), is list of dictionary.&amp;nbsp; Do you know why it is breaking in one scenario, and not the other?&amp;nbsp; I feel like I am missing something obvious haha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78106?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 07:21:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3875b88-f78b-4e1c-8500-60e84aad7baf</guid><dc:creator>Stefan Helzle</dc:creator><description>[deleted]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78094?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 21:18:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4f4127bb-8635-411f-a5f8-2a286a6671f8</guid><dc:creator>walkers0001</dc:creator><description>&lt;p&gt;Thank you both&amp;nbsp;&lt;a href="/members/stefanh791"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="/members/chris"&gt;Chris&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I have included what I came up with below.&amp;nbsp; It is formatted&amp;nbsp;to&amp;nbsp;paste into a blank interface in order to monitor performance.&amp;nbsp; It is working, but is there any way to make it more efficient?&amp;nbsp;I noticed that for a medium size data set of 375 rows similar to the data in this example, local!dataFinal took almost 1 second.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78089?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 19:46:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cd8741ee-d1fe-4121-9884-b1ab0b7044e9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;The get the plugin dictionary manipulation (&lt;a href="/b/appmarket/posts/cdt-manipulation"&gt;https://community.appian.com/b/appmarket/posts/cdt-manipulation&lt;/a&gt;), use the function&amp;nbsp;getKeysFromDictionary() and a foreach to iterate on the keys.&amp;nbsp;In that plugin is a function&amp;nbsp;&lt;span&gt;createDictionary() which should help you creating the output.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78087?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 19:36:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:64dd5712-2ad6-4850-8012-a79f9af29eb3</guid><dc:creator>walkers0001</dc:creator><description>&lt;p&gt;I am receiving the values in e notation.&amp;nbsp; I never need to show them to my user, but I need to pass the values back through an integration as text.&amp;nbsp; I know about the text fuction, the issue is more doing it dynamically with a list of dictionary that will never have the same key value pairs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78086?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 19:33:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e5bfe35a-299a-4138-af3a-2eb1b28fcea3</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Are you getting the decimals in e-notation or is it just the way Appian displays it? In the latter case, this has been discussed here multiple times. If you need to display long decimals to your user, then use the text() function to format it in the way you like.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most efficient way to convert all numbers in an array of dictionary to text</title><link>https://community.appian.com/thread/78081?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 17:51:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c113eabd-e021-4549-be61-d15291b870de</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;For this to work with any dictionary, you will be doing some json conversions.&amp;nbsp; Here is a quick sample to get you going, re-using some code from Stefan &lt;a href="/discussions/f/general/8577/is-there-a-way-to-dynamically-add-a-new-element-to-a-dictionary/76170#76170"&gt;in another thread&lt;/a&gt; on dictionary manipulation:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!data: {
    {field1: &amp;quot;value1asdf&amp;quot;},
    {field2: &amp;quot;1.234e+10&amp;quot;},
    {field3: &amp;quot;value3test&amp;quot;}
  },

  reduce(
    updatecdt(_,_),
    cast(&amp;#39;type!{http://www.appian.com/ae/types/2009}Dictionary&amp;#39;, {}),
    a!forEach(
      items: local!data,
      expression: {
        a!localVariables(
          local!pair: split(a!toJson(fv!item),&amp;quot;:&amp;quot;),
          local!key: stripwith(local!pair[1],&amp;quot;&amp;quot;&amp;quot;{&amp;quot;),
          local!value: stripwith(local!pair[2],&amp;quot;&amp;quot;&amp;quot;}&amp;quot;),
          
          a!fromJson(
            substitute(
              a!toJson(
                {
                  p_l_a_c_e_h_o_l_d_e_r: if(
                    search(&amp;quot;e+&amp;quot;,local!value)&amp;gt;0,
                    rule!chris_test_convert_scientific_notation(value: local!value),
                    local!value
                  )
                }
              ),
              &amp;quot;p_l_a_c_e_h_o_l_d_e_r&amp;quot;,
              local!key
            )
          )
        )
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Helper rule!chris_test_convert_scientific_nocation(value [text]):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!split: split(ri!value,&amp;quot;e+&amp;quot;),
  local!count: len(split(local!split[1],&amp;quot;.&amp;quot;)[2]),
  
  concat(
    stripwith(local!split[1],&amp;quot;.&amp;quot;),
    makerange(tointeger(local!split[2])-local!count,&amp;quot;0&amp;quot;)
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>