Feature Request Tracker

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

Report

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é

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.

Add comment or return to search results.

Watch This Report

If you would like to be notified whenever updates are made to this report, please fill in your email address in the box below and click on "Notify Me of Changes" button. (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Topic ID" field helps to protect against spambots. Please enter the feature request ID (which you can find at the top of this page).

(Optional.)
E mail:
Confirm E mail:
Confirm Topic ID:

To unsubscribe from all notifications use the notifications page.

Comment

You can append a comment to this report using the form below. Comments are checked first before being added. Any spam or offensive content will be removed first according to this site's Terms of Website Use. Please bear in mind that I develop and maintain free software in my spare time. If you want commerical level support then you can hire a TeX consultant.

The "Confirm Feature Request ID" field helps to protect against spambots. Please enter the feature request ID (which you can find at the top of this page).

(Optional. If provided, it will be shown with the comment.)
Confirm Feature Request ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

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

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

Click on the Preview button to preview the message.

Return to search results.