0

i use datatools to create pdf But last column display Null or blank

My minimal coding:

\documentclass[a5paper,oneside,8pt]{article}
\usepackage[a5paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{datatool}
\usepackage{filecontents}
\begin{filecontents*}{fileabc.tex}
AAA|BBB|CCC|DDD|
1|TNMT\_100|NT|E1|
2|TNMT\_109|NT|EE|
3|TNMT\_210|AT|E|
4|TNMT\_340|NT|E30|
5|TNMT\_12|AT|E31|
\end{filecontents*}
\usepackage{datatool}
\DTLsetseparator{|}
\DTLsetdelimiter{"}
\DTLloaddb[autokeys=false]{fileabc}{fileabc.tex}



\newcommand{\printCCCCoding}[1]{%
 \par

 \DTLforeach*
 [\DTLiseq{\CCCCoding}{#1}]%
 {fileabc}% Database
 {\CCCCoding=CCC,\AAACoding=AAA, \BBBCoding=BBB,\DDDCoding=\DDD}{%
 \noindent \CCCCoding \hspace{0.1cm} 2 \AAACoding \hspace{0.1cm}  3 \BBBCoding \hspace{0.1cm} 4 \DDD \par
  }% 
}

\begin{document}


\DTLdisplaydb{fileabc}
%\newpage
\\
\printCCCCoding{NT}

\end{document}

enter image description here Thanks

1

The syntax of your DDD column in \printCCCCoding is incorrect. It should be similar to the other columns:

\newcommand{\printCCCCoding}[1]{%
 \par

 \DTLforeach*
 [\DTLiseq{\CCCCoding}{#1}]%
 {fileabc}% Database
 {\CCCCoding=CCC,\AAACoding=AAA, \BBBCoding=BBB,\DDDCoding=DDD}{%
 \noindent \CCCCoding \hspace{0.1cm} 2 \AAACoding \hspace{0.1cm}  3 \BBBCoding \hspace{0.1cm} 4 \DDDCoding \par
  }% 
}

Note the \DDDCoding=DDD instead of the original \DDDCoding=\DDD and correspondingly \DDDCoding in the next line.

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.