Hi folks,
I'm making a document with a lot of tables. I have templates for all
the kinds of tables, so authors only have to use the predefined macros
to fill the tables. That is working pretty well, but I still have two
little problems.
The first one, is that some of the author filled fields in the tables
should be part of the content table of the document, but in the filled
table itself, they should still look as normal text. To do so, I have
defined my own section, this way:
\definehead[fieldNameSection][subsection]
\setuphead[fieldNameSection][number=no, textstyle=\tfe]
And made a table of contents:
\definecombinedlist[content][fieldNameSection,myheader,subsection,subsubsection][textstyle=\tf]
\setupcombinedlist [content][alternative=c,textstyle=\tf]
So if I do:
\fieldNameSection{Some Title}
And then:
\placecontent
It works well and shows the entry in the table of contents. But when I
do it inside the table macro definition, and then use the macro:
\def\bCrudCampo{
\doifnothing{\getvariable{CrudCampo}{CrudCampo}}
{\section{DescripciĆ³n de Campos}}
\setvariables[CrudCampo][CrudCampo=FLG]
\bgroup
\def\bNombreCampoGUI##1\eNombreCampoGUI{
\setvariables[CrudCampo][NombreCampoGUIVAL={##1}]
\setvariables[CrudCampo][NombreCampoGUIFLG=FLG]
}
}
\def\eCrudCampo{
\def\keyNombreCampoGUI{Nombre del Campo (GUI):}
\setupTABLE[c][1][width=0.2\textwidth]
\setupTABLE[c][2][width=0.8\textwidth]
\bTABLE[frame=on]
\bTR
\bTD {\bf \keyNombreCampoGUI} \eTD
\bTD
% COMENTED --
% \doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
% {\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}
% COMENTED --
\fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}
\eTD
\eTR
\eTABLE
\vskip2mm
\egroup
}
So when I use the
\fieldNameSection{*\getvalue{CrudCampo:NombreCampoGUIVAL}*}
in the previous code I get nothing but an empty entry in the table of
contents (well in fact with the * before and after I get just **).
The entry is shown in the TOC, but I don't see the text, only the dots
and the page number. It's like at some point the variable is empty at
the moment of generating the table of contents or something like that.
I really have not a clue about what I'm doing wrong...
The second issue is that the previous commented code:
\doifelsenothing{\getvariable{CrudCampo}{NombreCampoGUIFLG}}
{\EMPTY}{\getvariable{CrudCampo}{NombreCampoGUIVAL}}
Is the best way I've found so far to show an EMPTY in one of the
table fields when the author forgets to fill a row when using the
template. I've tried a lot of combinations of \setvariable, \setvalue,
and several \doifSOMETHING, but at this point it only works if the
author omits the \bNombreCampoGUI \eNombreCampoGUI pair, but if he
puts the commands, but left the content empty, then I don't get
EMPTY as result in the table and only got an empty string (nothing)
and I would like to have the EMPTY in both cases. Also I don't like
to use the variable NombreCampoGUIFLG, I think it's just a dirty
trick, but is the only solution I found so far. Is there a better way
to do the empty test there to achieve the desired behavior?
Thanks in advance, for any opinion, suggestion, critics or help :-)
Best Regards,
DemiƔn.
___
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___