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

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to