This is a follow-up question to How to verify if entry `country = {}` is empty in a custom BibLaTeX library?
I have a custom BibLaTeX library with the BiBLaTeX entry Contribution, which I use to manage all my oral and poster contributions on conferences, workshops etc. Thanks to the help I got on the site mentioned above, I have a nice working system.
However, there are some cosmetic issues: I have an entry called period which includes the time period of, e.g., a conference. It shall appear behind the event title in brackets (see example below). In a .dbx file, I declare the entry field period as a date datatype, and I can therefore call the command \printperiod. So far, so good.
In some BibLaTeX entries, this field period is empty, so period = {}.
How can I find out via an 'if', 'then' 'else' condition, if \printperiod is printing text, so as to say if period = {}?
I tried out \iffieldundef{period}, \ifciteindex and other things but I don't get it working.
So far, here is first the MWE:
\begin{filecontents}{contribution.dbx}
\DeclareDatamodelEntrytypes{contribution}
\DeclareDatamodelFields[type=field,datatype=literal]{
type,
invited,
title,
event,
eventshort,
eventtype,
league,
url,
place,
city,
country,
year,
note,
timestamp
}
\DeclareDatamodelFields[type=field, datatype=datepart]{
year,
month,
day,
periodyear,
periodmonth,
periodday
}
\DeclareDatamodelFields[type=field, datatype=date, skipout]{
date,
period,
}
\DeclareDatamodelFields[type=list,datatype=name]{
author,
presenter,
}
\DeclareDatamodelEntryfields[contribution]{
type,
invited,
author,
presenter,
title,
event,
eventshort,
eventtype,
league,
url,
place,
city,
country,
date,
period,
year,
note,
timestamp}
\end{filecontents}
\begin{filecontents}{\jobname.bib}
@Contribution{Oral_2016_1,
Type = {Oral},
Invited = {invited},
Author = {Author1, A. and Author2, B. and Author3, C. and Author4, D.},
Presenter = {Author2, B.},
Title = {{Cool stuff about the nano-world}},
Event = {{22$^{\rm nd}$ International Conference on Nanotechnology}},
Eventshort= {{NANO-7}},
Eventtype = {Conference},
League = {International},
URL = {},
Place = {Alto University},
City = {Helsinki},
Country = {Finland},
Date = {2016-05-31},
Period = {2016-05-22/2016-06-02},
Year = {2016},
Note = {},
Timestamp = {}
}
@Contribution{Oral_2016_2,
Type = {Oral},
Invited = {},
Author = {Author1, A. and Author2, B. and Author3, C. and Author4, D.},
Presenter = {Author1, B.},
Title = {{Cool stuff about the nano-world}},
Event = {{22$^{\rm nd}$ International Workshop on NanoPhenomena}},
Eventshort= {{IWNP-8}},
Eventtype = {Workshop},
League = {International},
URL = {},
Place = {University of Nano},
City = {Tokyo},
Country = {Japan},
Date = {2016-03-04},
Period = {},
Year = {2016},
Note = {},
Timestamp = {}
}
\end{filecontents}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[datamodel=contribution,
style=chem-acs,
dateabbrev=false,
natbib=true,
backend=biber]
{biblatex}
\addbibresource{\jobname.bib}
% My own command, which puts into format and prints the complete contribution.
\DeclareCiteCommand{\citeallstuff}
{\defcounter{maxnames}{99}%
\defcounter{minnames}{99}%
\defcounter{uniquename}{2}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{%
\ifciteindex{\indexnames*{labelname}}{}\printnames{labelname}, %
\iffieldundef{title}{}{\textit{\printtext{\printfield{title}}}\space}%
\iffieldundef{event}{}{\printtext{\printfield{event}}}%
\space(\printperiod)\addcomma\space% <============ What must I do there?
\iffieldundef{city}{}{\printtext{\printfield{city}}}%
\iffieldundef{country}{\addcomma\space}{ \printtext{(\printfield{country}})\addcomma\space}%
\printdate% <============ The same here?
\iffieldundef{note}{}{\addcomma\space\printtext{\printfield{note}}}%
\iffieldundef{invited}{}{\addcomma\space{\textbf{\printtext{\printfield{invited}}}}}
}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{document}
\noindent\citeallstuff{Oral_2016_1}\\\\\\
\citeallstuff{Oral_2016_2}
\printbibliography
\end{document}
As one can see, the second citation has a () behind the event title, because the field 'period' is empty, period = {}. In this case, the two brackets should not appear but instead a comma and space.
Thanks for some help.
PS: Small additional question: How can I change, e.g., May 31 to May 31$^{\rm st}$?

bibilatex3.7/Biber 2.7.date-like fields must end indate, so you can' haveperiod, it must be calledperioddate. – moewe Jan 25 '17 at 07:55eventdatefor conference proceedings that you could probably reuse. There is also the fieldvenuewhich you could use instead of maybeplace. – moewe Jan 25 '17 at 08:20\iffieldindefs are not necessary if you use\DeclareFieldFormatand\newunit/\setunitproperly. Have a look at my alternative answer to your other question, maybe that can give you an idea of how to approach this in a morebiblatex-y way. Read §4.11.7 Using the Punctuation Tracker of thebiblatexdocumentation – moewe Jan 25 '17 at 12:03eventdatethough, you might be able to get away with few changes). – moewe Jan 25 '17 at 14:12