* \processcommalist and load values into macros. @ 2013-06-03 21:47 Jaroslav Hajtmar 2013-06-04 17:34 ` Wolfgang Schuster 0 siblings, 1 reply; 5+ messages in thread From: Jaroslav Hajtmar @ 2013-06-03 21:47 UTC (permalink / raw) To: mailing list for ConTeXt users 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. Thanx Jaroslav Hajtmar Minimal example: \let\filename\null \let\firstname\null \let\surname\null \let\city\null \let\street\null \let\postcode\null \def\dosomething#1{#1\par} \def\loadlistdatatomacros#1,#2,#3,#4,#5 { \global\def\firstname{#1} \global\def\surname{#2} \global\def\town{#3} \global\def\street{#4} \global\def\postcode{#5} } \startbuffer[mypostbuffer] \dosomething % \loadlistdatatomacros FIRSTNAME: \firstname\par SURNAME: \surname\par CITY \city\par STREET \street\par POSTCODE \postcode\par \page \stopbuffer \starttext \processcommalist[ {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 }, ]{\getbuffer[mypostbuffer]} \stoptext ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: \processcommalist and load values into macros. 2013-06-03 21:47 \processcommalist and load values into macros Jaroslav Hajtmar @ 2013-06-04 17:34 ` Wolfgang Schuster 2013-06-04 18:26 ` Jaroslav Hajtmar 0 siblings, 1 reply; 5+ messages in thread From: Wolfgang Schuster @ 2013-06-04 17:34 UTC (permalink / raw) To: hajtmar, mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: \processcommalist and load values into macros. 2013-06-04 17:34 ` Wolfgang Schuster @ 2013-06-04 18:26 ` Jaroslav Hajtmar 2013-06-04 18:40 ` Wolfgang Schuster 0 siblings, 1 reply; 5+ messages in thread From: Jaroslav Hajtmar @ 2013-06-04 18:26 UTC (permalink / raw) To: mailing list for ConTeXt users Hello Wolfgang. There is any problem in first method. I get message "Nested tabulate is not (yet) supported". Thanx Jaroslav Hajtmar Here is problematic example: \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} \define[5]\TestOtherCommand{#1, #2, #3, #4, #5\par} \defineseparatedlist[test][command=\TestCommand] \defineseparatedlist[othertest][command=\TestOtherCommand] \starttext Method 1: \starttest John, Smith, Prague, Václavské náměstí 20, 115 00 Peter, Paul, Brno, Nad struhou 232/12, 234 20 Annie, Walter, Ostrava, Pod lipami 7, 321 54 \stoptest \startothertest John, Smith, Prague, Václavské náměstí 20, 115 00 Peter, Paul, Brno, Nad struhou 232/12, 234 20 Annie, Walter, Ostrava, Pod lipami 7, 321 54 \stopothertest \stoptext Dne 4.6.2013 19:34, Wolfgang Schuster napsal(a): > 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: \processcommalist and load values into macros. 2013-06-04 18:26 ` Jaroslav Hajtmar @ 2013-06-04 18:40 ` Wolfgang Schuster 2013-06-04 21:23 ` Jaroslav Hajtmar 0 siblings, 1 reply; 5+ messages in thread From: Wolfgang Schuster @ 2013-06-04 18:40 UTC (permalink / raw) To: hajtmar, mailing list for ConTeXt users Am 04.06.2013 um 20:26 schrieb Jaroslav Hajtmar <hajtmar@gyza.cz>: > Hello Wolfgang. > There is any problem in first method. > I get message "Nested tabulate is not (yet) supported". There was a bug in the database module regarding the command key, update your installation and it will work. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: \processcommalist and load values into macros. 2013-06-04 18:40 ` Wolfgang Schuster @ 2013-06-04 21:23 ` Jaroslav Hajtmar 0 siblings, 0 replies; 5+ messages in thread From: Jaroslav Hajtmar @ 2013-06-04 21:23 UTC (permalink / raw) Cc: mailing list for ConTeXt users Thanx Wolfgang very much. After update standalone version of ConTeXt is first database method working OK. You proposed methods are acceptable and comfortable for me. Moreover, it is systemic solutions. Thanks very much for the reply and for the inspiration. Jaroslav Hajtmar Dne 4.6.2013 20:40, Wolfgang Schuster napsal(a): > Am 04.06.2013 um 20:26 schrieb Jaroslav Hajtmar <hajtmar@gyza.cz>: > >> Hello Wolfgang. >> There is any problem in first method. >> I get message "Nested tabulate is not (yet) supported". > There was a bug in the database module regarding the command key, > update your installation and it will work. > > 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-06-04 21:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-03 21:47 \processcommalist and load values into macros Jaroslav Hajtmar 2013-06-04 17:34 ` Wolfgang Schuster 2013-06-04 18:26 ` Jaroslav Hajtmar 2013-06-04 18:40 ` Wolfgang Schuster 2013-06-04 21:23 ` Jaroslav Hajtmar
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).