I want to define a command with key arguments, which stores something in a table with help of the package datatool. My attempt is :
\documentclass[12pt]{scrartcl}
\usepackage{keycommand}
\RequirePackage{datatool}
\begin{document}
% declare a new table
\DTLnewdb{table}
% define the command
\newkeycommand{\myCom}[op=1]{%
\DTLnewrow{table}
\DTLnewdbentry{table}{option}{\commandkey{op}}
}
%call 4 times the command
\myCom[op=2]
\myCom[op=3]
\myCom[op=4]
\myCom[op=5]
% display the content of the table
\DTLdisplaydb{table}
I would expect "2 3 4 5", but i get "5 5 5 5". This is actually a common problem that i encounter regularly with datatools (that somehow "only the last operation is taken into account"), which shows probably that i still don't know how to use it properly... What am i doing wrong here ?