From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: hajtmar@gyza.cz, mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \processcommalist and load values into macros.
Date: Tue, 4 Jun 2013 19:34:33 +0200 [thread overview]
Message-ID: <232EAB69-DCD9-42B0-88AA-CF15C586298A@gmail.com> (raw)
In-Reply-To: <51AD0EDB.1010609@gyza.cz>
Am 03.06.2013 um 23:47 schrieb Jaroslav Hajtmar <hajtmar@gyza.cz>:
> Hello ConTeXist.
> Obviously I have a problem with expansion. My question is:
> How can I place the elements of the list into macros for later use?
> Basically, my point is that I want assign individual values into macros within the cycle of and those subsequently used in a buffer to creating my own report.
> Perhaps is can be understood what I want from my minimal example.
I suggest to use a different method to store and load the data. The first method
is to use the database module (you can also use a external file for the data),
the other method is the \setvariables command where you can use keys for
the entries.
Method 1:
\usemodule[database]
\define[5]\TestCommand
{\starttabulate
\NC FIRSTNAME \EQ #1 \NC\NR
\NC SURNAME \EQ #2 \NC\NR
\NC CITY \EQ #3 \NC\NR
\NC STREET \EQ #4 \NC\NR
\NC POSTCODE \EQ #5 \NC\NR
\stoptabulate
\page}
\defineseparatedlist[test][command=\TestCommand]
\starttext
\starttest
John, Smith, Prague, Václavské náměstí 20, 11500
Peter, Paul, Brno, Nad struhou 232/12, 234 20
Annie, Walter, Ostrava, Pod lipami 7, 321 54
\stoptest
\stoptext
Method 2:
\startsetups[test]
\starttabulate
\NC FIRSTNAME \EQ \getvariable{test}{firstname} \NC\NR
\NC SURNAME \EQ \getvariable{test}{surname} \NC\NR
\NC CITY \EQ \getvariable{test}{city} \NC\NR
\NC STREET \EQ \getvariable{test}{street} \NC\NR
\NC POSTCODE \EQ \getvariable{test}{postcode} \NC\NR
\stoptabulate
\page
\stopsetups
\setvariable{test}{set}{\setups{test}}
\starttext
\setvariables
[test]
[firstname=John,
surname=Smith,
city=Prague,
street=Václavské náměstí 20,
postcode=11500]
\setvariables
[test]
[firstname=Peter,
surname=Paul,
city=Brno,
street=Nad struhou 232/12,
postcode=234 20]
\setvariables
[test]
[firstname=Annie,
surname=Walter,
city=Ostrava,
street=Pod lipami 7,
postcode=321 54]
\stoptext
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2013-06-04 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 21:47 Jaroslav Hajtmar
2013-06-04 17:34 ` Wolfgang Schuster [this message]
2013-06-04 18:26 ` Jaroslav Hajtmar
2013-06-04 18:40 ` Wolfgang Schuster
2013-06-04 21:23 ` Jaroslav Hajtmar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=232EAB69-DCD9-42B0-88AA-CF15C586298A@gmail.com \
--to=schuster.wolfgang@gmail.com \
--cc=hajtmar@gyza.cz \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).