Feature Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 39🔗
Date: 2016-05-31 09:48:07
Status Closed (Not Implemented)
Category datatool
Summary DTLiflastrow for conditions in foreach

Sign in to subscribe to notifications about this report.

Description

Dear Nicola Talbot,

your datatool-package is very great and helps me in a lot of cases (even with big amounts of data). Sometimes I am iterating through a database with the DTLforeach-command and a condition. The condition leaves some rows out, maybe the last.

Is it possible to have a command within foreach, that can decide wether it will be the last row in the loop and not in the database itself? It seems a little bit complicated, because the DTLforeach seems to read the next row of the database every loop iteration and decides then, if the condition matches. Maybe it is possible to store the output of every iteration with a match of the condition in a savebox (e.g. the box in tcolorbox) and print the savebox when datatool knows, what row will be the last one?

wkr
André

MWE

No mwe.tex

Evaluation

Unfortunately I don't think this is possible in general as it would need to look ahead and scan the rest of the database at the end of each iteration to determine if the current row is the last to satisfy the condition, which would be very inefficient. It would be quicker to simply have two loops: the first to determine the final row index and the second to test the current row index against the previously found final row index. It would be even better if the first loop saved a list of the required row indexes and then the second loop iterated over that list (instead of the entire database). An even faster approach would be to use datatooltk to perform the filtering.

Comments

0 comments.


Add Comment

Name (optional):

Are you human? Please confirm the feature request ID (which can be found at the top of this page) or login if you have an account.

Comment:


You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/featuretracker.php?key=39