I intend to create a document where parts of the text are read from the entries of a .csv file using the package datatool (version 2012/09/25 v2.11., updated manually under debian).
Everything works fine as I want:
activities.csv:
"Role","Activity","NbActivity"
"Role 1","Activity A",1
"Role 1","Activity B",2
"Role 2","Activity C",3
read by the following .tex file:
\documentclass{minimal}
\usepackage[english]{babel}
\usepackage{datatool}
\DTLloaddb[]{activities}{activities.csv}
\begin{document}
\DTLforeach{activities}
{\role=Role, \activity=Activity, \NbA=NbActivity}{
\role
\activity \\
}
\end{document}
For the purpose of the document that I would like to create, rows of the database should be copied by the number indicated in the "NbActivity" column, resulting in something like that,...
"Role","Activity","NbActivity"
"Role 1","Activity A",1
"Role 1","Activity B",2
"Role 1","Activity B",2
"Role 2","Activity C",3
"Role 2","Activity C",3
"Role 2","Activity C",3
... in order to repeat those entries in the text as follows:
Role 1 Activity A
Role 1 Activity B
Role 1 Activity B
Role 2 Activity C
Role 2 Activity C
Role 2 Activity C
I tried to solve this by using \DTLnewdbentry and loops as suggested in Repeat command n times?, but just can't figure out how to do this.
I am new to LaTeX programming/ macros, and would really appreciate any help, thank you.
