<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Row merge with logic in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409811#M1272735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are close, but the code in the aggregate function is only saving the value from the second record in each group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In prepare, your code should be &lt;STRONG&gt;work={ }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then in aggregate, you code should be &lt;STRONG&gt;work[#work+1] = input&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then don't you need to compare the entries in the two records to determine the SwapType?&amp;nbsp; To extract a value use code similar to &lt;STRONG&gt;work[1].SwapType&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jan 2013 17:24:13 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-01-10T17:24:13Z</dc:date>
    <item>
      <title>Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409804#M1272715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to be able to transform some data which includes some aggregation and a group by.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data I have consists of 2 rows of data that have the same ID but some different attribute values. The main requirement I am trying to achieve is the ability to take say Column A's 2 rows and transpose them out into a single row, but with some logic applied. At the same time I would like to Group the two rows and Sum one of the other values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached a simple example file that shows the starting data and the target with some notes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can help in pointing out the right artifacts to use and approaches that would be great. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2026 18:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409804#M1272715</guid>
      <dc:creator />
      <dc:date>2026-01-26T18:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409805#M1272719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example that will hopefully help out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Work:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;LOAD ID, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpotPrice, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Currency, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Term&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;C:\Hold\RowConsolidate.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;(ooxml, embedded labels, table is Sheet2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Tab1:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;LOAD ID, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(SpotPrice&amp;lt;0, 'Pay ' &amp;amp; Type, 'Received ' &amp;amp; Type) as NewType,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpotPrice, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Currency, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Term&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Resident Work&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;WHERE Type = 'Fixed';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;JOIN&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;LOAD ID, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpotPrice as RSpotPrice, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Term as ReceivedTerm&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Resident Work&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;WHERE Type = 'Floating';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Final:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewType,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpotPrice + RSpotPrice as SpotPrice,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Term,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReceivedTerm,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Currency&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Resident Tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;Drop table Tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'trebuchet ms', geneva;"&gt;drop table Work;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always like to load the table into Qlikview first and then manipulate using QV functions.&amp;nbsp; After you load the whole table in, you can load your first set of rows, then the second set joining on ID.&amp;nbsp; Then one final pass through you can add the logic to get the price and then drop the work tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2013 17:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409805#M1272719</guid>
      <dc:creator>markmccoid</dc:creator>
      <dc:date>2013-01-09T17:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409806#M1272722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to confirm:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Each swap will always be represented by two rows.&lt;/LI&gt;&lt;LI&gt;One row in a swap will be Type Fixed and one row Type Floating&lt;/LI&gt;&lt;LI&gt;One row of a swap will always have a negative SpotPrice while the other row in the swap will have a positive SpotPrice&lt;/LI&gt;&lt;LI&gt;There are only two SwapType values: Pay Fixed, Receive Floating&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To implement this logic in QlikView Expressor you would most likely use a Function Rule in an Aggregate operator, supplying code in the &lt;STRONG&gt;prepare&lt;/STRONG&gt;, &lt;STRONG&gt;aggregate&lt;/STRONG&gt;, and &lt;STRONG&gt;result&lt;/STRONG&gt; functions.&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In the &lt;STRONG&gt;prepare&lt;/STRONG&gt; function, you would initialize an empty Datascript table&lt;/LI&gt;&lt;LI&gt;In the &lt;STRONG&gt;aggregate&lt;/STRONG&gt; function, you would store each record from a swap into the Datascript table&lt;/LI&gt;&lt;LI&gt;In the &lt;STRONG&gt;result&lt;/STRONG&gt; function, you would examine the two records saved in the Datascript table to determine the swap type based on whether Fixed or Floating contained the negative value.&amp;nbsp; Then, initialize the output values as appropriate.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2013 17:57:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409806#M1272722</guid>
      <dc:creator />
      <dc:date>2013-01-09T17:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409807#M1272725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark, unfortunately this is for Qlikview Expressor &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2013 19:37:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409807#M1272725</guid>
      <dc:creator />
      <dc:date>2013-01-09T19:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409808#M1272728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your assumptions are correct, apart from 4, there can be alternative variations (Pay Floating,Rec Fixed) etc, but I dont think that poses to much trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your approach sounds fine as the prepare/agg/result seems to solve the logic and doing it within the aggregate transform should do the math. However the row of data has about 100+ other attributes that I probably wont need to feed through the logic or aggregate (they may have to go through seperate logic) or they are the same for each row, if I feed these through a plain transform seperately I assume I will still end up with 2 rows for each swap but how will the output of the aggregate function be seen duplicated for each swap?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to try to build something now so I can see what the output is, I just need to have a read around this Datascript table piece, is this th normal way to hold a set of data to process?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2013 19:50:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409808#M1272728</guid>
      <dc:creator />
      <dc:date>2013-01-09T19:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409809#M1272731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there really are 100+ other fields, then you probably don't want to pass them into this Aggregate as it will really crowd the rule editor (although you could take this approach adding the values from the first or last record to the output record).&amp;nbsp; Your additional transformations could be performed in a Transform operator downstream of this Aggregate operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you can block these attributes from entering this Aggregate in an upstream Transform.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you pass these fields through another stream to carry out additional transformations, you can join them back to the aggregated record with a Join operator.&amp;nbsp; You need to decide if you only want one final record emitted for each swap.&amp;nbsp; If you do, then this second stream also goes into an Aggregate operator, but you can simply emit one record that contains the values derived from the first record (or last record).&amp;nbsp; Then, there will be only one record emitted from each Aggregate and only a single record emitted after you join their content together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If, on the other hand, you want an emitted record for both of the records documenting the swap, there would be no need for the second Aggregate operator.&amp;nbsp; The Join operator will emit two records for each swap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a table to store each record in an aggregation group is generally not something that is necessary within the Aggregate operator.&amp;nbsp; The concept behind this operator is that only the running calculation is maintained for a group, the values in each incoming record are unimportant after the math has been performed.&amp;nbsp; But in your use case, you need all the records in the group to decide on the Swap Type, so you need to save the records in the &lt;STRONG&gt;aggregate&lt;/STRONG&gt; function and analyze them in the &lt;STRONG&gt;result&lt;/STRONG&gt; function.&amp;nbsp; Since each swap only involves two records, this is not an issue (even if all 100+ fields were present).&amp;nbsp; If, on the other hand your groups contain a very large number of records, there is the possibility that sufficient memory will not exist to hold all the records.&amp;nbsp; In this case, you may need to drop some of the values from each record and only hold those you need for the follow-on analysis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2013 20:14:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409809#M1272731</guid>
      <dc:creator />
      <dc:date>2013-01-09T20:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409810#M1272733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attempted to build this and after reading around the datascript language I have put together a data flow, now below is the script from the aggregate artifact, it works (as in doesnt error) which is a good start, the output is quite what I was expecting, I managed to join it back to the rest of the data (without filtering so I still have two rows), but the valued that I expect to be summed seems to be the result of the same row * 2 as opposed to the sum of 2 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the script look ok, or have I missed something? I was trying to use a sum() function in the result but it kept throwing an error so I followed the example in the help file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="28964" class="jive-image-thumbnail jive-image" onclick="" alt="Datascript_aggregate.jpg" src="https://community.qlik.com/legacyfs/online/28964_Datascript_aggregate.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 16:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409810#M1272733</guid>
      <dc:creator />
      <dc:date>2013-01-10T16:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409811#M1272735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are close, but the code in the aggregate function is only saving the value from the second record in each group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In prepare, your code should be &lt;STRONG&gt;work={ }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then in aggregate, you code should be &lt;STRONG&gt;work[#work+1] = input&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then don't you need to compare the entries in the two records to determine the SwapType?&amp;nbsp; To extract a value use code similar to &lt;STRONG&gt;work[1].SwapType&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 17:24:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409811#M1272735</guid>
      <dc:creator />
      <dc:date>2013-01-10T17:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409812#M1272737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jamesjnr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please check the attachment,Please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jiveImage" src="https://community.qlik.com/" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 19:27:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409812#M1272737</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-01-10T19:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409813#M1272740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shaik, this disscussion is for Qlikview Expressor unfortunately, but thanks for the effort.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 21:28:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409813#M1272740</guid>
      <dc:creator />
      <dc:date>2013-01-10T21:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409814#M1272742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again, many thanks John.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now that I have put my coding hat back on I can see how this works, this great example of mixing Code with data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it's cracked, I managed to get the aggregate to output the values I was expecting and yes I see how you can just use the index pointer in the data table to get the values you after. I can see why the Sum would'nt help me, that's just me thinking of SQL again..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also added the downstream aggregator and added all the columns as the group by and I get the single row output I was after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a great example for anyone interested the aggregate script is below which can be used to obtain specific row in a group and perform some aggregation, worth noting that you specify the Group By values in the artifacts properties in the dataflow window.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="28982" class="jive-image-thumbnail jive-image" onclick="" alt="aggregate_script_working.jpg" src="https://community.qlik.com/legacyfs/online/28982_aggregate_script_working.jpg" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="28983" class="jive-image-thumbnail jive-image" onclick="" alt="aggregate_script_working1.jpg" src="https://community.qlik.com/legacyfs/online/28983_aggregate_script_working1.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 22:34:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409814#M1272742</guid>
      <dc:creator />
      <dc:date>2013-01-10T22:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409815#M1272744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code in your latest version of the result function is not as rich as the code in your prior version.&amp;nbsp; Are you sure you are doing all the analysis that you wanted?&amp;nbsp; Don't you need to compare the values in Type and SpotPrice from both records to determine the value to be assigned to SwapType?&amp;nbsp; Or can you make that decision based just on the values in the first record of each pairing?&amp;nbsp; I don't understand the logic behind setting the SwapType value to Pay Fixed, Receive Fixed, Pay Floating, and Receive Floating.&amp;nbsp; The logic of your decision function doesn't match the required result presented in the data file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 14:24:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409815#M1272744</guid>
      <dc:creator />
      <dc:date>2013-01-11T14:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409816#M1272746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The result I currently get isn't exactly perfect, I was more interested in getting the whole aggregation and calculation working rather than the logic behind the Swap Type, in the previous script I had been playing with variations of the decision function to see results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I still need to do a check to decide the swap type, I will implement that shortly, the logic behind the Type selection hasn't changed , but the required result has, in all cases each record the Fixed part takes precendent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So every grouped Swap will be xxx Fixed , xxx being Pay or Receive depending on the sign of the price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have implemented this using the code below, I've tested this and it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #a9a9a9; font-weight: bold;"&gt;output.SwapType&lt;/SPAN&gt; &lt;SPAN style="color: #006400;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #191970; font-weight: bold;"&gt;decision&lt;/SPAN&gt; &lt;SPAN style="color: #006400;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;Type &lt;SPAN style="color: #006400;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Fixed"&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;and&lt;/SPAN&gt; work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;SpotPrice &lt;SPAN style="color: #006400;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;"Pay Fixed"&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;Type &lt;SPAN style="color: #006400;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Floating"&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;and&lt;/SPAN&gt; work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;SpotPrice &lt;SPAN style="color: #006400;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;"Receive Fixed"&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;Type &lt;SPAN style="color: #006400;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Fixed"&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;and&lt;/SPAN&gt; work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;SpotPrice &lt;SPAN style="color: #006400;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Receive Fixed"&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;Type &lt;SPAN style="color: #006400;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Floating"&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;and&lt;/SPAN&gt; work&lt;SPAN style="color: #006400;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;].&lt;/SPAN&gt;SpotPrice &lt;SPAN style="color: #006400;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #006400;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;"Pay Fixed"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #006400;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 15:30:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409816#M1272746</guid>
      <dc:creator />
      <dc:date>2013-01-11T15:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Row merge with logic</title>
      <link>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409817#M1272748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, much clearer.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nice use of the decision function.&amp;nbsp; As this code illustrates, the proper decision is made regardless of which of the two records per swap is stored in work[1].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this example.&amp;nbsp; It shows a nice usage of the Aggregate operator function rule.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 15:39:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-merge-with-logic/m-p/409817#M1272748</guid>
      <dc:creator />
      <dc:date>2013-01-11T15:39:08Z</dc:date>
    </item>
  </channel>
</rss>

