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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently learning how to use the datatool package. I have a lot of .txt-files that need to be processed automatically. But if datatool loads a wrong kind of .txt-file I need to be able to check it. The way I want to do it is to check the key's of the columns, but the command \DTLgetkeyforcolumn returns the error:

Undefined control sequence.
<argument> \db@row@id@w

l.58 \DTLgetkeyforcolumn{\colkey}{data}{1}

I have absolutely no clue what that means... The source code can be found in the datatool manual. Search for the function and you will get to it. I really don't understand it, and can't see anywhere \db@row@id@w. Could it be a bug in the package? Trying to redefine the function only results in errors.

Minimal working example:


\DTLloadrawdb{data}{data.txt} %load data.txt, store in database data

  % Display the table, bold are the headers

  % Search for header ColTwo and store index into \colindex
  \colindex % returns 2

  % Search the index and store the header into \colkey
  \DTLgetkeyforcolumn{\colkey}{data}{\colindex} % Error




Gives no output at all.

share|improve this question
Could you post a minimal working example (MWE) that illustrates your problem? It helps us to track the error down. :) – Paulo Cereda Jul 13 '12 at 16:51
Added, but it doesn't work mind you ;) – Didii Jul 16 '12 at 7:43
Seems like a bug. Maybe you should contact the package maintainer. – canaaerus Jul 16 '12 at 7:55
I've sent a mail to him, thanks for the reply. – Didii Jul 16 '12 at 8:56
up vote 1 down vote accepted

I've sent a mail to the package maintainer (Nicola Talbot) who gave me a temporary workaround. Paste the following under \usepackage{datatool}. This bug will be fixed in a future patch.

 \def\@dtl@get@keyforcolumn##1% before stuff
   \db@plist@elt@w% start of block
   \db@col@id@w #3\db@col@id@end@% index
   \db@key@id@w ##2\db@key@id@end@% key
   \db@type@id@w ##3\db@type@id@end@% data type
   \db@header@id@w ##4\db@header@id@end@% header
   \db@col@id@w #3\db@col@id@end@% index
   \db@plist@elt@end@% end of block
 \edef\@dtl@tmp{\expandafter\the\csname dtlkeys@#2\endcsname}%
   \db@plist@elt@w% start of block
   \db@col@id@w #3\db@col@id@end@ %index
   \db@key@id@w \@nil\db@key@id@end@% key
   \db@type@id@w \db@type@id@end@% data type
   \db@header@id@w \db@header@id@end@% header
   \db@col@id@w #3\db@col@id@end@% index
   \db@plist@elt@end@% end of block
share|improve this answer

Your Answer


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.