I've been trying to get to the substring of a value retrieved by datatool's, macro \DTLfetch, but I am unable to control the expansion here. I've tried some \expandarg \fullexpandarg as well as some \edef.
I don't necessarily need to use datatool to retrieve the contents or xstring to perform the substring-command,, but I am required to not alter the datafile. Otherwise, I would just have regex-ed it.
Output
Code
\documentclass{article}
\usepackage{datatool}
\usepackage{xstring}
\usepackage{filecontents}
\begin{filecontents*}{data.csv}
x,y
duck,quack
donkey,hee-haw
\end{filecontents*}
\DTLloaddb{data}{data.csv}
\begin{document}
original value:
\DTLfetch{data}{x}{donkey}{y}%
substring(failing):
% \fullexpandarg%
\expandarg%
\StrRight{%
\DTLfetch{data}{x}{donkey}{y}%
}{3}
Expecting output:
\StrRight{%
hee-haw%
}{3}
\end{document}

