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 with scientific notation in any list of dictionaries into text so that they are readable in Appian?
It needs to work with any dictionary, so I cannot rely on consistent key value pairs.
Here is a real example of the data I am receiving. I have bolded some examples:
Discussion posts and replies are publicly visible
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.
I am receiving the values in e notation. I never need to show them to my user, but I need to pass the values back through an integration as text. 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
The get the plugin dictionary manipulation (https://community.appian.com/b/appmarket/posts/cdt-manipulation), use the function getKeysFromDictionary() and a foreach to iterate on the keys. In that plugin is a function createDictionary() which should help you creating the output.
Thank you both Stefan Helzle and Chris.I have included what I came up with below. It is formatted to paste into a blank interface in order to monitor performance. It is working, but is there any way to make it more efficient? 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.
Stefan Helzlethanks for this, it looks good and performs about the same as my original version. Now I am running into a different issue, and I am wondering if you have any ideas, or know why it is happening. There are a few places where I need to sort the resulting list of dictionary by different fields in the dictionary. Unfortunately, after I apply either your or my versions of the code to switch the format of the numbers, I get an error. I have included two scenarios to showcase this:Scenario 1: Original data, no errorThe 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. Do you know why it is breaking in one scenario, and not the other? I feel like I am missing something obvious haha.
I just moved to another company and have a new account so I cannot modify older posts anymore. Please contact Appian support at email@example.com.
© 2024 Appian. All rights reserved.