Assuming your comments are of the form (<text>), you can do like this:
\begin{filecontents*}{\jobname.csv}
1 (comment to suppress), 2 (another comment to suppress), 3
\end{filecontents*}
\documentclass{article}
\usepackage{datatool}
\makeatletter
\newcommand{\decomment}[1]{%
\expandafter\de@comment#1()\@nil{#1}%
}
\def\de@comment#1(#2)#3\@nil#4{%
\def#4{#1}%
}
\makeatother
\DTLloaddb[noheader]{db}{\jobname.csv}
\begin{document}
\DTLgetvalue{\firstvalue}{db}{1}{1}
\DTLgetvalue{\secondvalue}{db}{1}{2}
\DTLgetvalue{\thirdvalue}{db}{1}{3}
\decomment{\firstvalue}\decomment{\secondvalue}\decomment{\thirdvalue}
\firstvalue{} and \secondvalue{} and \thirdvalue{}
\end{document}
Curiously enough, the first entry becomes 1(comment to suppress), so the space cannot be safely removed this way, without a more complex check.
An easier method is with l3regex:
\begin{filecontents*}{\jobname.csv}
1 (comment to suppress), 2 (another comment to suppress), 3
\end{filecontents*}
\documentclass{article}
\usepackage{datatool}
\usepackage{xparse,l3regex}
\ExplSyntaxOn
\NewDocumentCommand{\decomment}{m}
{
\regex_replace_once:nnN { \s*\(.*\)\s*\Z } { } #1
}
\ExplSyntaxOff
\DTLloaddb[noheader]{db}{\jobname.csv}
\begin{document}
\DTLgetvalue{\firstvalue}{db}{1}{1}
\DTLgetvalue{\secondvalue}{db}{1}{2}
\DTLgetvalue{\thirdvalue}{db}{1}{3}
\decomment{\firstvalue}\decomment{\secondvalue}\decomment{\thirdvalue}
\firstvalue{} and \secondvalue{} and \thirdvalue{}
\end{document}
The regular expression is “any number of spaces followed by (, by arbitrary tokens, by ), by spaces and the end of the token list”.
<space>(<text>)? – egreg Dec 17 '16 at 18:53datatoolas a placeholder for comments. – Diaa Dec 17 '16 at 18:56