Sorry to pick up an old topic (http://archive.contextgarden.net/message/20101221.082006.4dc83f26.en.html), but I seem to have the same problem with m-database at mentioned in this old thread. I am trying to "freely" use the data fields in a layout other than (natural) Tables. An update of context (15.2.2012) doesn't help. The example from the CSV MyWay fails as well as the simplified example below with following error: \doprocessdatabase ...ameter \c!command \!!es , }} l.14 \stopAddressen Modifying m-database.lua as suggested in the old thread seems to have no effect on the error... Though I suspect the file has been changed since anyhow. Thanks for any input, Martin Code used: \usemodule[database] \def\SendMe#1#2{#1\crlf#2} \defineseparatedlist [Addressen] [separator={;},command=\SendMe] \starttext \startAddressen xyz;Maasstraat abc;sometown \stopAddressen \stoptext using the variant doesn't help: \startseparatedlist[Addressen] xyz;Maasstraat abc;sometown \stopseparatedlist
Am 15.02.2012 um 16:06 schrieb Martin:
Sorry to pick up an old topic (http://archive.contextgarden.net/message/20101221.082006.4dc83f26.en.html), but I seem to have the same problem with m-database at mentioned in this old thread.
I am trying to "freely" use the data fields in a layout other than (natural) Tables.
An update of context (15.2.2012) doesn't help.
The example from the CSV MyWay fails as well as the simplified example below with following error:
\doprocessdatabase ...ameter \c!command \!!es , }} l.14 \stopAddressen
Modifying m-database.lua as suggested in the old thread seems to have no effect on the error... Though I suspect the file has been changed since anyhow.
Thanks for any input, Martin
Code used:
\usemodule[database]
\def\SendMe#1#2{#1\crlf#2}
\unexpanded\def\SendMe#1#2{#1\crlf#2} Wolfgang
\unexpanded\def\SendMe#1#2{#1\crlf#2}
Wolfgang
Wolfgang, thanks, that worked for the sample code. However, when extended to three fields (I need 8) the field splitting gets rather messy. Thanks, Martin Modified code: \usemodule[database] \unexpanded\def\SendMe#1#2#3{#1\crlf#2\crlf#3} \defineseparatedlist [Addressen] [separator={;},command=\SendMe] \starttext \startAddressen house1;street1;name1 house2;street2;name2 \stopAddressen \stoptext Result is in attached PDF (hope that's ok)
Am 15.02.2012 um 21:54 schrieb Martin:
\unexpanded\def\SendMe#1#2{#1\crlf#2}
Wolfgang
Wolfgang, thanks, that worked for the sample code. However, when extended to three fields (I need 8) the field splitting gets rather messy.
I had to look at the example in the module for this and what I saw is that you can only use commands with *one* but this isn’t a real problem, when you describe what do you want to do with the entries I can provide you with a solution for this. Wolfgang
Admittedly I feel a bit lost when looking at the various processing modules... My goal is to create template based output. I have created a rough mail-merge example (with LibreOffice) and attached it as PDF for illustration. There is a CSV database with currently 8 fields, probably a few more will be added. These fields need to be placed into a form, in my example a list of courses. Other forms based on the same data should follow. These forms/lists will then be printed. Hope that makes sense. Maybe I'm pushing the database module a bit to far, but I was just trying to avoid "mail-merges"... thanks, Martin Am 15.02.12 22:08, schrieb Wolfgang Schuster:
Am 15.02.2012 um 21:54 schrieb Martin:
\unexpanded\def\SendMe#1#2{#1\crlf#2}
Wolfgang
Wolfgang, thanks, that worked for the sample code. However, when extended to three fields (I need 8) the field splitting gets rather messy.
I had to look at the example in the module for this and what I saw is that you can only use commands with *one* but this isn’t a real problem, when you describe what do you want to do with the entries I can provide you with a solution for this.
Wolfgang
On 16-2-2012 12:03, Martin wrote:
Admittedly I feel a bit lost when looking at the various processing modules...
My goal is to create template based output. I have created a rough mail-merge example (with LibreOffice) and attached it as PDF for illustration.
There is a CSV database with currently 8 fields, probably a few more will be added. These fields need to be placed into a form, in my example a list of courses. Other forms based on the same data should follow. These forms/lists will then be printed.
Hope that makes sense. Maybe I'm pushing the database module a bit to far, but I was just trying to avoid "mail-merges"...
\starttext \startluacode -- or: str = io.loaddata(somefile) local str = [[ 1,2,3,4,5,6,7,8 a,b,c,d,e,f,g,h ]] local list = string.splitlines(str) for i=1,#list do local fields = utilities.parsers.settings_to_array(list[i]) if fields[1] then context("field 1: %s",fields[1]) context.par() end end \stopluacode \stoptext so: - read in the cvs file - split them into lines - loop over each line - split that line - and mess around with the fields ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Martin
-
Wolfgang Schuster