Skip to content

Bug? - Sorting and Filtering Duplicates from Datasets #261

@Demosteneus

Description

@Demosteneus

There is a small issue when sorting and removing duplicates from datasets.
Although the sorting and the filtering works quite well, there is an issue with these layout functions: position() and last().

For example in the below example:
position goes from 1 to 3 (which is the correct number of unique entries). But last is still 5, which is the unfiltered total.

<data>
  <elt value="one" test="11" test2="22" test3="33" DuplicateIndex="same"/>
  <elt value="two" test="11" test2="22" test3="33" DuplicateIndex="same"/>
  <elt value="three" test="11" test2="22" test3="33" DuplicateIndex="same"/>
  <elt value="three" test="11" test2="22" test3="33" DuplicateIndex="66"/>
  <elt value="three" test="11" test2="22" test3="33" DuplicateIndex="77"/>  
</data>
<Layout xmlns:sd="urn:speedata:2009/publisher/functions/en" xmlns="urn:speedata.de:2009/publisher/en" xmlns:xi="http://www.w3.org/2001/XInclude" version="3.9.27">
<Record element="data">
  <SetVariable variable="unsorted" select="*"/>
  <SetVariable variable="sorted">
    <SortSequence select="$unsorted" criterion="value" removeduplicates="value"/>
  </SetVariable>
  <PlaceObject>
    <Textblock>
      <ForAll select="$sorted">
        <Paragraph><Value select="@value"/><Value select="concat('Position is', position())"/><Value select="concat('Last is', last())"/></Paragraph>
      </ForAll>
    </Textblock>
  </PlaceObject>
</Record>
</Layout>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions