Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug? - Sorting and Filtering Duplicates from Datasets #261

Closed
Demosteneus opened this issue Aug 14, 2020 · 1 comment
Closed

Bug? - Sorting and Filtering Duplicates from Datasets #261

Demosteneus opened this issue Aug 14, 2020 · 1 comment
Assignees
Labels

Comments

@Demosteneus
Copy link

Demosteneus commented Aug 14, 2020

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>
@pgundlach pgundlach self-assigned this Aug 14, 2020
@pgundlach pgundlach added the Bug label Aug 14, 2020
@pgundlach
Copy link
Member

pgundlach commented Aug 14, 2020

Fixed in Version 3.9.29. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants