<?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>Test</title><link>https://community.appian.com/discussions/f/rules/38923/test</link><description>Here is the use case Name1 is the section names value1 is the text value,when next section name starts with item2 before empty section names consider as section names with the text followed by as mentioned in the output 
 expected output is [ { &amp;quot;section</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Test</title><link>https://community.appian.com/thread/147231?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 14:22:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b83e810f-8d2d-4da8-a281-429516fe6297</guid><dc:creator>Zakary Melvin</dc:creator><description>&lt;p&gt;If the other answers don&amp;#39;t get you what you&amp;#39;re looking for you could always change the way you define local!testData to be a list of map like below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;local!testData: {
  a!map(
    section: &amp;quot;Item 1&amp;quot;, 
    fullText: {
      &amp;quot;Data for Item 1&amp;quot;,
      &amp;quot;Different data for Item 2&amp;quot;,
      &amp;quot;Some other kind of data&amp;quot;
    }
  ),
  a!map(
    section: &amp;quot;Item 2&amp;quot;, 
    fullText: {
      &amp;quot;Another example of data&amp;quot;,
      &amp;quot;Random data like GBP 50,000&amp;quot;
    }
  ),
  a!map(
    section: &amp;quot;Item 3&amp;quot;, 
    fullText: {
      &amp;quot;Data related to an event or value&amp;quot;,
      &amp;quot;Adjustable by percentage of revenue&amp;quot;,
      &amp;quot;Premium payable quarterly&amp;quot;
    }
  )
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Test</title><link>https://community.appian.com/thread/147210?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 08:28:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:04d17930-274a-4da4-bbb5-fce8b3e3c398</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;OK, then here is my solution. There are very simple alternatives to foreach(),&lt;/p&gt;
&lt;p&gt;This helper expression either updates the last item in the list and concatenates the text, or adds a new section item. The created value is then passed to the next iteration by the reduce() function.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1744705480762v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1744705505760v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: need to get the sections in between the text</title><link>https://community.appian.com/thread/147209?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 08:08:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:614aad62-0278-458c-8258-4836bb1b0b59</guid><dc:creator>harshithar688624</dc:creator><description>&lt;p&gt;Great &lt;a href="/members/yashwantha0914"&gt;Yashwanth Akula&lt;/a&gt;&amp;nbsp;&lt;br /&gt;really appreciated&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: need to get the sections in between the text</title><link>https://community.appian.com/thread/147207?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 06:27:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8488ef0c-9b50-4e3a-a1aa-4cddd740db9c</guid><dc:creator>Yashwanth Akula</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/harshithar688624"&gt;harshithar688624&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!testdata: {
    {
      &amp;quot;Name1&amp;quot;: &amp;quot;Item1&amp;quot;,
      &amp;quot;Value1&amp;quot;: &amp;quot;Data for Item 1&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Different data for Item 2&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Some other kind of data&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: &amp;quot;Item2&amp;quot;,
      &amp;quot;Value1&amp;quot;: &amp;quot;Another example of data&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Random data like GBP 50,000&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Hii data like GBP 50,000&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: &amp;quot;Item3&amp;quot;,
      &amp;quot;Value1&amp;quot;: &amp;quot;Data related to an event or value&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Adjustable by percentage of revenue&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;Premium payable quarterly&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: null,
      &amp;quot;Value1&amp;quot;: &amp;quot;party payable quarterly&amp;quot;
    },
    {
      &amp;quot;Name1&amp;quot;: &amp;quot;Item4&amp;quot;,
      &amp;quot;Value1&amp;quot;: &amp;quot;Item four data&amp;quot;
    }
  },
  local!uniqueName: reject(
    fn!isnull,
    union(
      local!testdata.Name1,
      local!testdata.Name1
    )
  ),
  local!indexes: a!forEach(
    items: enumerate(length(local!uniqueName)) + 1,
    expression: a!localVariables(
      local!first: index(local!uniqueName, fv!item, {}),
      local!second: index(local!uniqueName, fv!item + 1, null),
      if(
        a!isNullOrEmpty(local!second),
        {},
        a!map(
          startIndex: index(
            wherecontains(
              tostring(local!first),
              touniformstring(local!testdata.Name1)
            ),
            1,
            &amp;quot;&amp;quot;
          ),
          endIndexPlusOne: index(
            wherecontains(
              tostring(local!second),
              touniformstring(local!testdata.Name1)
            ),
            1,
            &amp;quot;&amp;quot;
          )
        )
      )
    )
  ),
  local!finalNameStartIndex: local!indexes[length(local!indexes)].endIndexPlusOne,
  a!flatten(
    {
      a!forEach(
        items: local!indexes,
        expression: a!map(
          section: index(
            local!testdata.Name1,
            fv!item.startIndex,
            &amp;quot;&amp;quot;
          ),
          fullText: joinarray(
            index(
              local!testdata.Value1,
              enumerate(
                tointeger(fv!item.endIndexPlusOne) - fv!item.startIndex
              ) + fv!item.startIndex,
              &amp;quot;&amp;quot;
            ),
            &amp;quot; &amp;quot;
          )
        )
      ),
      a!map(
        section: index(
          local!testdata.Name1,
          local!finalNameStartIndex,
          &amp;quot;&amp;quot;
        ),
        fullText: joinarray(
          index(
            local!testdata.Value1,
            {
              enumerate(
                length(local!testdata) - local!finalNameStartIndex + 1
              ) + local!finalNameStartIndex
            },
            &amp;quot;&amp;quot;
          ),
          &amp;quot; &amp;quot;
        )
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hope it helps. please test it with some scenarios; let me know is it working fine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: need to get the sections in between the text</title><link>https://community.appian.com/thread/147203?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 06:00:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a9fa2966-0292-4299-92d1-9717ec2f2749</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I think this can be solved using the reduce function. In a blog post, I describe how to implement such algorithms. Specifically how the create stable shared values across iterations.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://appian.rocks/2022/08/29/complex-algorithms-in-appian/"&gt;appian.rocks/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>