<?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>Read Value From CSV</title><link>https://community.appian.com/discussions/f/general/19322/read-value-from-csv</link><description>Hi Experts, 
 
 I have a requirement where I need to read the number from a CSV file where delimiter is &amp;quot;,&amp;quot; and value is also containing comma in it. also the value is in double quotes Kindly suggest how I can read it. 
 sample value &amp;quot;123,456,789&amp;quot;, this</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/116569?ContentTypeID=1</link><pubDate>Thu, 20 Jul 2023 16:47:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b4f9a9fd-15c0-489e-a751-a243db4561a6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Any possibility you can convert it into an Excel file first, then use tools like &amp;quot;readExcelSheetPaging()&amp;quot; from Excel Tools?&amp;nbsp; I believe you would need far less manual parsing that way (as it would presumably handle the column separation for you on the back end), leaving you only the relatively simple task of sanitizing numbers to remove commas where applicable in column values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/116562?ContentTypeID=1</link><pubDate>Thu, 20 Jul 2023 16:14:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:20910040-464d-4add-a244-83f353cd4f61</guid><dc:creator>pierpaolo.longobardi</dc:creator><description>&lt;p&gt;Hi Stewart, I got the same problem but I have to elaborate a huge amount of string for my csv. Is there any smarter way to split data from the csv so that I don&amp;#39;t have to add risks of performance in my rule?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/75609?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 15:03:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fce0b673-1ad3-4336-bee5-21bc2b48f087</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Ok, so you may have to extract your data using two different techniques:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;to get the first two values you can simply use fn!split() with a comma as the delimiter and just reference the first two instances in the generated array and ignore the rest&lt;/li&gt;
&lt;li&gt;to get the last value you can find the positions of the quotes, extract the characters between those positions and cast to a numeric value&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/75606?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 14:55:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0b5fa97d-250d-4973-9ae3-10bfa5f1a905</guid><dc:creator>GauravSingh</dc:creator><description>&lt;p&gt;Unluckily data length is&amp;nbsp;varying&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Would reach out on the same post if I get some workaround.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your suggestions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/75603?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 14:16:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9ccf7df4-482b-463c-a71e-541fb8216d50</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Ok got it. My first instinct is that it would be easier if the file that is being generated can be altered to chnage this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;test1,05,&amp;quot;123,452,46.05&amp;quot;
test2,06,&amp;quot;123,321,46.05&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;test1,05,12345246.05
test2,06,12332146.05&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;...but assuming this is not an option...if the first two columns are always the same length, you could extract the string containing the numeric value using fn!mid(), starting at the first quote and ending at the end of the string (you&amp;#39;d need to use fn!len() to determine the length of the string in case the numeric value varied in length). Then you can remove the quotes using fn!stripwith(), and then cast to a numeric value using fn!todecimal()&lt;/p&gt;
&lt;p&gt;If the first two columns can also vary in length then we&amp;#39;d have to re-think the design.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/75598?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 11:57:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5e8f5ea0-dd24-4a5a-852e-00b1e9c3989e</guid><dc:creator>GauravSingh</dc:creator><description>&lt;p&gt;Hi Stewart,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Values are like: Name,Month,Value,test1,05,&amp;quot;123,452,46.05&amp;quot;,&lt;span&gt;test2,06,&amp;quot;123,321,46.05&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Where Name,Month,Value are the column headers. which contains data in 2 rows: test1,05,&amp;quot;123,452,46.05&amp;quot; and test2,06,&amp;quot;123,321,46.05&amp;quot; in respective columns&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Gaurav Singh&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read Value From CSV</title><link>https://community.appian.com/thread/75596?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 10:31:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d23a4823-eac9-47a6-b726-aa2425f02070</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Hi Gaurav - are you saying ALL of the values in your CSV file will be contained in double quotes? e.g.:&lt;/p&gt;
&lt;p&gt;&amp;quot;Apple&amp;quot;,&amp;quot;123,456,789&amp;quot;,&amp;quot;Banana&amp;quot;,&amp;quot;987,7654,321&amp;quot;&lt;/p&gt;
&lt;p&gt;One option would be to format the data by:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;splitting the data using the combination of quote and comma as the delimiter&lt;/li&gt;
&lt;li&gt;stripping out all of the remaining quotes so your data is now an array of their basic values&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;...and then, assuming you can always be sure that an item will be a number based upon its position in the array, cast it from text to integer (or decimal)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>