Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

how do I use csvsimple (or what else? pgfplotstable?) with more than 1 condition as filter (i need about 7) to show a filtered csv-file as table? I tried things like:

filter=\equal{\gender}{m} and \equal{\grade}{5.0}

but that does not work. Example see below. Thanks.

\documentclass{article}
\usepackage{csvsimple}
\usepackage{filecontents}

\begin{filecontents*}{testdata.csv}
name,gender,grade
Hans,m,1.0
Anna,f,2.3
Anton,m,5.0
Hilde,f,5.0
\end{filecontents*}


\begin{document}

\begin{tabular}{lc}
\csvreader[head to column names,filter=\equal{\gender}{m}]{testdata.csv}{}
{\\\name & \grade} 
\end{tabular}

\begin{tabular}{lc}
\csvreader[head to column names,filter=\equal{\grade}{5.0}]{testdata.csv}{}
{\\\name & \grade} 
\end{tabular}

\begin{tabular}{lc}
\csvreader[head to column names,filter=\equal{\gender}{m} and \equal{\grade}{5.0]{testdata.csv}{}
{\\\name & \grade} 
\end{tabular}

\end{document}
share|improve this question

1 Answer 1

enter image description here

the package seems to use ifthenelse internally so you can use that package's boolean expressions involving \and and \or.

So I just changed one line to:

\csvreader[head to column names,filter=\equal{\gender}{m} \and \equal{\grade}{5.0}]{testdata.csv}{}
share|improve this answer
    
Thank you..... :) –  Daniel Jul 6 '12 at 20:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.