<?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>Split the values</title><link>https://community.appian.com/discussions/f/new-to-appian/28068/split-the-values</link><description>Hi Everyone, 
 Can anyone please help me how to split values, for example if input is 102-105; 109-111 then output should be 102, 103, 104, 105, 109, 110, 111.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109809?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 13:13:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b629738-2123-463a-82e8-d8da6680985f</guid><dc:creator>SangeerththanBalachandran</dc:creator><description>&lt;p&gt;Above approach we can split the data in an extensible manner according to the available symbols but the resultant data have to be filtered based on the requirements in this case I haven&amp;#39;t filtered the data just flattened. The above approach is mentioned considering the &amp;quot;;&amp;quot; can be either in string or array. But As I mentioned according to the requirement author can remove the data which are not relevant.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109806?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:55:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f20d1952-b586-4cc4-bc43-1f06da201eeb</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;In what way this fulfills the requirement of the author? And why you are trying to split on &amp;quot;;&amp;quot; , if it is already a list of string.&lt;/p&gt;
&lt;p&gt;Have a clear look at the use case first.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109805?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:27:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1811878a-7e59-438b-8499-851b46f7696d</guid><dc:creator>SangeerththanBalachandran</dc:creator><description>&lt;p&gt;Hi, You can have the symbols as an array and split like below&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!data: {&amp;quot;102-105&amp;quot;; &amp;quot;109-111&amp;quot;},
  local!symbolsToSplit: { &amp;quot;-&amp;quot;, &amp;quot;;&amp;quot; },
  local!splittedData:a!forEach(
    items: local!data,
    expression: split(fv!item, local!symbolsToSplit),
  ),
  a!flatten(local!splittedData)
)&lt;/pre&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109804?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:22:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7defd50-2301-4e62-ab1a-03448ab07025</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f622.svg" title="Cry"&gt;&amp;#x1f622;&lt;/span&gt;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f647_2D00_1f3fb.svg" title="Bow tone1"&gt;&amp;#x1f647;&amp;#x1f3fb;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109803?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:15:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0df7d591-5c5d-4729-b454-023f56a65177</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!values: { &amp;quot;101-104&amp;quot;;4, 5, &amp;quot;7-9&amp;quot; },
  a!forEach(
    items: local!values,
    expression: if(
      like(fv!item, &amp;quot;*-*&amp;quot;),
      a!localVariables(
        local!value: split(fv!item, &amp;quot;-&amp;quot;),
        enumerate(local!value[2] - (local!value[1] - 1)) + local!value[1]
      ),
      fv!item
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109802?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:07:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:62f70042-72ba-4471-83d3-097f4d5109eb</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;A little change in Ujjwal&amp;#39;s code can do the trick.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!values: { &amp;quot;101-105&amp;quot;;4, 5, 6, &amp;quot;121-123&amp;quot; },
  local!seperateValues: a!forEach(
    items: local!values,
    expression: tointeger(split(fv!item, &amp;quot;-&amp;quot;))
  ),
  local!finalValues: a!forEach(
    local!seperateValues,
    if(
      length(fv!item) = 1,
      append(fv!item, fv!item),
      fv!item
    )
  ),
  a!flatten(
    a!forEach(
      items: local!finalValues,
      expression: fv!item[1] + enumerate(fv!item[2] + 1 - fv!item[1])
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;edit: Use below code&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f447_2D00_1f3fb.svg" title="Point down tone1"&gt;&amp;#x1f447;&amp;#x1f3fb;&lt;/span&gt; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109800?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 11:41:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:85c6b1b4-ef59-4cd2-9322-7b86854697cc</guid><dc:creator>shubhamy0005</dc:creator><description>&lt;p&gt;Thank you all for your answers.&lt;/p&gt;
&lt;p&gt;I also need to split the values {101-104; 4, 5, 7-9}&amp;nbsp; as 101,102,103,104,4,5,7, 8,9 which is separated by both comma and semi colon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109454?ContentTypeID=1</link><pubDate>Wed, 15 Mar 2023 14:08:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19007845-ceba-4cab-ae27-8ed060f351a8</guid><dc:creator>Nicole Walter</dc:creator><description>&lt;p&gt;Hi! This is definitely something I can help you with. It seems that what you need to do is to return the values at the beginning and end of the ranges given as inputs.&lt;/p&gt;
&lt;p&gt;To start, we would take your beginning input and process it into local variables. I&amp;#39;m guessing your input is either a list of string, like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;{
&amp;quot;102-105&amp;quot;,
&amp;quot;109-111&amp;quot;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Or&amp;nbsp;&lt;/em&gt;it is a single string where the value pairings are concatenated by a semicolon, like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;quot;102-105; 109-111&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In the first case, the code below should be able to accomplish this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!input: {
    &amp;quot;102-105&amp;quot;,
    &amp;quot;109-111&amp;quot;
  },
  /*We begin by iterating over our list of strings.*/
  a!foreach(
    items: local!input,
    /*Next, we want to break apart the given item in the list
    and use it to create a range of numbers that is inclusive
    on both bounds.*/
    expression: a!localVariables(
      /*The split funtion will break apart our input at the given
      character, which in this case is the dash sign. It will return
      a list of all the characters on either side of the dash.*/
      local!splitInput: split(fv!item, &amp;quot;-&amp;quot;),
      /*By indexing into the first item in this list, we will have
      the lower end of the range of numbers to generate.*/
      local!startRange: local!splitInput[1],
      /*The end of that range is the second item in the list*/
      local!endRange: local!splitInput[2],
      /*Finally, we use the enumerate function to generate the
      list of numbers. Because we want to generate a list of numbers
      that begins at our startRange, and ends at our endRange, we 
      only have enumerate however many numbers exist within that range.
      The result of our endRange minus our startRange gives that number
      of numbers, and because enumerate goes from 0 to n-1, we increment
      the range by one. Additionally, the output of enumerate must have
      the start range added to each value in the resulting list, 
      as done below, so that we can have the list start at our range and end
      the appropriate number of numbers after (which will be our endRange!)
      */
      local!startRange + enumerate(
        local!endRange-local!startRange+1
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In our second case, we use effectively the same code, but break apart our inputs differently, by using split() to create a list of strings out of the initial single string input. The code below could be used as the value for the &amp;quot;items&amp;quot; argument in the a!foreach function in the code snippet above to do so.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;split(local!input, &amp;quot;;&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As a final note, this code will produce a list of lists of numbers. If you need a flat list of just the numbers, I recommend using the &lt;a href="https://docs.appian.com/suite/help/21.3/fnc_array_a_flatten.html"&gt;flatten&lt;/a&gt; function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split the values</title><link>https://community.appian.com/thread/109407?ContentTypeID=1</link><pubDate>Wed, 15 Mar 2023 05:40:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e1538ca8-9162-4e65-aac2-fe90babdd8c2</guid><dc:creator>aditya007</dc:creator><description>&lt;p&gt;a!localVariables(&lt;br /&gt; local!input:&amp;quot;102-105; 109-111&amp;quot;,&lt;br /&gt; local!values:split(local!input,&amp;quot;;&amp;quot;), &lt;br /&gt; local!seperateValues:a!forEach(&lt;br /&gt; items: local!values,&lt;br /&gt; expression: tointeger(split(fv!item,&amp;quot;-&amp;quot;))&lt;br /&gt; ),&lt;br /&gt; a!flatten(&lt;br /&gt; a!forEach(&lt;br /&gt; items: local!seperateValues,&lt;br /&gt; expression: fv!item[1] + enumerate(fv!item[2]+1-fv!item[1])&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: Split the values</title><link>https://community.appian.com/thread/109305?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 08:29:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:213df36b-1618-4370-8514-1c2f93bb3e9f</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Hi, check the below code&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!values:{
    &amp;quot;101-105&amp;quot;,
    &amp;quot;111-120&amp;quot;,
    &amp;quot;121-123&amp;quot;
  },  
  local!seperateValues:a!forEach(
    items: local!values,
    expression: tointeger(split(fv!item,&amp;quot;-&amp;quot;))
  ),
  a!flatten(
    a!forEach(
      items: local!seperateValues,
      expression: fv!item[1] + enumerate(fv!item[2]+1-fv!item[1])
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>