[Tex/LaTex] Biblatex – How to suppress some fields for multiple entry types

biblatex

Based on lockstep's answer here, I wrote

\ifentrytype{book,collection,incollection}{%
}{%
\clearfield{url}%
\clearfield{urldate}%
\clearfield{review}%
\clearfield{series}%
}%

to suppress the URL and its date for the listed source types. The catch is, it even suppresses the URL for @ONLINE sources now, even if I only specify one entry type. Is the code above outdated or is it due to my settings?

Output

enter image description here

MWE, made after musicman's answer

\documentclass{article}

\usepackage[
style=authoryear-icomp
]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book,collection,incollection}{
    \clearfield{url}%
    \clearfield{urldate}%
    \clearfield{review}%
    \clearfield{series}%%
}{}
}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
  author = {AAAAbook, A.},
  year = {2001},
  title = {Alpha},
  url = {tex.stackexchange.com},
}
@online{Bonline,
  author = {BBBBonline, B.},
  year = {2002},
  title = {Bravo},
  url = {tex.stackexchange.com},
}
@collection{Ccollection,
    editor = {CCCCColletionEditor, C.},
    year = {2002},
    title = {Charlie},
    url = {tex.stackexchange.com},
}
@incollection{Dincollection,
    author = {DDDDincollection, D.},
    year = {2002},
    crossref = {Ccollection},
    title = {Delta},
    url = {tex.stackexchange.com},
}
\end{filecontents}

\addbibresource{test-lit.bib}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}

Best Answer

Apparently the rules have to be defined on an per-type-basis so the answer is: not possible.

Output

enter image description here

MWE

    \documentclass{article}

\usepackage[
style=authoryear-icomp
]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book}{
    \clearfield{url}%
    \clearfield{urldate}%
    \clearfield{review}%
    \clearfield{series}%%
}{}
\ifentrytype{collection}{
    \clearfield{url}%
    \clearfield{urldate}%
    \clearfield{review}%
    \clearfield{series}%%
}{}
\ifentrytype{incollection}{
    \clearfield{url}%
    \clearfield{urldate}%
    \clearfield{review}%
    \clearfield{series}%%
}{}
}

%%%%not working:
%%%\AtEveryBibitem{%
%%%\ifentrytype{book,collection,incollection}{%supresses the fields for those entrytypes
%%% \clearfield{url}%
%%% \clearfield{urldate}%
%%% \clearfield{review}%
%%% \clearfield{series}%
%%%}{}%the other entrytypes are nore affected
%%%}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
  author = {AAAAbook, A.},
  year = {2001},
  title = {Alpha},
  url = {tex.stackexchange.com},
}
@online{Bonline,
  author = {BBBBonline, B.},
  year = {2002},
  title = {Bravo},
  url = {tex.stackexchange.com},
}
@collection{Ccollection,
    editor = {CCCCColletionEditor, C.},
    year = {2002},
    title = {Charlie},
    url = {tex.stackexchange.com},
}
@incollection{Dincollection,
    author = {DDDDincollection, D.},
    year = {2002},
    crossref = {Ccollection},
    title = {Delta},
    url = {tex.stackexchange.com},
}
\end{filecontents}

\addbibresource{test-lit.bib}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}
Related Question