% This file is embedded in datatool-user.pdf version 3.4.2 2025-11-06
% Example 63 New Value Expansion
% Label: "ex:newvalueexpand"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool}
\makeatletter
\DTLsetup{new-value-expand=false}
\DTLnewdb{test1}
\DTLaddcolumnwithheader{test1}{entry}{Entry (Not Expanded)}
\@for\myentry:=ant,bee,duck,zebra\do{
 \DTLnewrow{test1}
 \DTLnewdbentry{test1}{entry}{\myentry}
}


\DTLsetup{new-value-expand=true}
\DTLnewdb{test2}
\DTLaddcolumnwithheader{test2}{entry}{Entry (Expanded)}
\@for\myentry:=ant,bee,duck,zebra\do{
 \DTLnewrow{test2}
 \DTLnewdbentry{test2}{entry}{\myentry}
}
\makeatother
\renewcommand{\myentry}{Unknown!} 
\begin{document}
\DTLdisplaydb{test1} \DTLdisplaydb{test2} 
\end{document}
