On 2013–02–02 Ingo Hohmann wrote: > I'm trying to have the date in a layer in an environment. In the > text using the environment, I want to be able to set the date. > If the date is not set, the current date should be used, otherwise > the set date. > This is what I've tried, but it is always the currentdate, that is > displayes. You are trying to use the date before it is defined. You can use a two-pass mechanism: \define\mydate{\datasetvariable{mydata}{date}{date}} \definelayer [firstpage] \setlayer [firstpage] [hoffset=14cm, voffset=3.5cm] {\framed[frame=on, width=4cm, height=2cm]{%% \doiftextelse{\mydate}{\mydate}{\currentdate}}} \setupbackgrounds [page] [background=firstpage] \definedataset [mydata] \setdataset [mydata] [date] [date=2011-11-11] \starttext \doiftextelse{\mydate}{\mydate}{\currentdate} \stoptext Marco