In the following example \DTLgetvalueforkey retrieves the information without problem, while \DTLfetch fails:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{data.csv}
Heading A, Heading B, Heading C
One, Een, 1
Two, Twee, 2
T_hree, Drie, 3
Four, Vier, 4
\end{filecontents*}
\usepackage{datatool}
\begin{document}
\DTLloadrawdb
[keys={HeadA,HeadB,HeadC}]
{data}{data.csv}
\DTLdisplaydb{data}
\bigskip
% \DTLgetvalueforkey{<cmd>}{<key>}{<db name>}{<ref key>}{<ref value>}
% \DTLfetch{<db name>}{<col1 name>}{<col1 value>}{<col2 name>}
\textbf{Heading A} = `Two' corresponds to \textbf{Heading B} =
\DTLgetvalueforkey{\datavalue}{HeadB}{data}{HeadA}{Two}\datavalue% Twee
\textbf{Heading A} = `Two' corresponds to \textbf{Heading B} =
\DTLfetch{data}{HeadA}{Two}{HeadB}% Twee
\textbf{Heading A} = `T\_hree' corresponds to \textbf{Heading B} =
\DTLgetvalueforkey{\datavalue}{HeadB}{data}{HeadA}{T\_hree}\datavalue% Drie
% Should be the same as above, but not found
\textbf{Heading A} = `T\_hree' corresponds to \textbf{Heading B} =
\DTLfetch{data}{HeadA}{T\_hree}{HeadB}% Drie
\end{document}
Why is this? Can \DTLfetch be fixed to work here?
The problem is specific to the use of _ inside CSV entries. The input I'm working with contains this, so there's very little I can do to remove it.
