The following code works as I would expect.
\documentclass{scrartcl}
\usepackage{csvsimple,filecontents}
\begin{document}
\begin{filecontents*}{chunk.csv}
AAAA,aaaaa
BBBB,bbbbb
CCCC,ccccc
DDDD,ddddd
EEEE,eeeee
FFFFF,fffffff
GGGGG,ggggg
HHHHHH,hhhhh
\end{filecontents*}
\csvreader[no head,before filter= \ifthenelse{\thecsvrow<4}{\csvfilteraccept}{\csvfilterreject}]{chunk.csv}{}{%
\begin{itemize}
\item \csvcoli , \csvcolii
\end{itemize}}
\end{document}
When I change the filter condition from "\thecsvrow<4
" to "\thecsvrow=4
" or "\thecsvrow>4
" the code breaks. Pointers as to how to make this work would be greatly appreciated.
Best Answer
The per-item testing should be performed when setting the item, rather than in the header, since the filter are set globally. From the
csvsimple
documentation:Low-level conditionals are used to (not) print each item, testing the value of
csvrow
.Here is an alternative option using
datatool
. The interface is very similar, and the transition should therefore not be a problem:Low-level conditionals are used to (not) print each item, testing the value of
DTLrowi
.