* error with m-database example
@ 2012-02-15 15:06 Martin
2012-02-15 20:12 ` Wolfgang Schuster
0 siblings, 1 reply; 11+ messages in thread
From: Martin @ 2012-02-15 15:06 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2012-02-15 15:06 error with m-database example Martin
@ 2012-02-15 20:12 ` Wolfgang Schuster
2012-02-15 20:54 ` Martin
0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2012-02-15 20:12 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2012-02-15 20:12 ` Wolfgang Schuster
@ 2012-02-15 20:54 ` Martin
2012-02-15 21:08 ` Wolfgang Schuster
0 siblings, 1 reply; 11+ messages in thread
From: Martin @ 2012-02-15 20:54 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 516 bytes --]
>
> \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)
[-- Attachment #2: csv-test.pdf --]
[-- Type: application/pdf, Size: 5821 bytes --]
[-- Attachment #3: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2012-02-15 20:54 ` Martin
@ 2012-02-15 21:08 ` Wolfgang Schuster
2012-02-16 11:03 ` Martin
0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2012-02-15 21:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2012-02-15 21:08 ` Wolfgang Schuster
@ 2012-02-16 11:03 ` Martin
2012-02-16 12:16 ` Hans Hagen
0 siblings, 1 reply; 11+ messages in thread
From: Martin @ 2012-02-16 11:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]
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
[-- Attachment #2: kursliste.pdf --]
[-- Type: application/pdf, Size: 44695 bytes --]
[-- Attachment #3: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2012-02-16 11:03 ` Martin
@ 2012-02-16 12:16 ` Hans Hagen
0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2012-02-16 12:16 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2010-12-20 21:32 ` Hans Hagen
@ 2010-12-21 8:20 ` Florian Wobbe
0 siblings, 0 replies; 11+ messages in thread
From: Florian Wobbe @ 2010-12-21 8:20 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Dec 20, 2010, at 22:32 , Hans Hagen wrote:
> On 20-12-2010 5:56, Mojca Miklavec wrote:
>> On Sun, Dec 19, 2010 at 20:37, Florian Wobbe wrote:
>>> Hi,
>>>
>>> The example from http://wiki.contextgarden.net/m-database gives me an error.
>>>
>>> ! LuaTeX error ...t-beta/texmf-context/tex/context/base/m-database.lua:74: bad argument #2 to 'lpegmatch' (string expected, got nil)
>>> stack traceback:
>>> [C]: in function 'lpegmatch'
>>> ...t-beta/texmf-context/tex/context/base/m-database.lua:74: in function 'process'
>>> <main ctx instance>:1: in main chunk.
>>> \doprocessdatabase ...ameter \c!command \!!es , }}
>>>
>>> l.18 \stopMyTable
>>>
>>>
>>> I also, tried the first example of Mojca's CSV May Way (http://dl.contextgarden.net/myway/csv.pdf) which gives me:
>>>
>>> ! Undefined control sequence.
>>> l.36 \startseparatedlist
>>> [NaturalTable]
>>>
>>> Thanks for any suggestions,
>>> Florian
>>
>> Dear Florian,
>>
>> Hans reimplemented the database module in MKIV. He requested a list of
>> problems that I have discovered in new implementation, but apparently
>> it's still on his TODO list to resolve them.
>
> replace line 42 in m-database.lua by:
>
> data = buffers.getlines(settings.database)
>
> (internally buffers used to be pre-split but that was changed)
Thanks Hans. Both examples work now, though I had to replace
\startseparatedlist[NaturalTable]
with
\startNaturalTable
in Mojca's CSV May Way example.
Florian
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2010-12-20 16:56 ` Mojca Miklavec
2010-12-20 17:46 ` Florian Wobbe
@ 2010-12-20 21:32 ` Hans Hagen
2010-12-21 8:20 ` Florian Wobbe
1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2010-12-20 21:32 UTC (permalink / raw)
To: Mojca Miklavec; +Cc: mailing list for ConTeXt users
On 20-12-2010 5:56, Mojca Miklavec wrote:
> On Sun, Dec 19, 2010 at 20:37, Florian Wobbe wrote:
>> Hi,
>>
>> The example from http://wiki.contextgarden.net/m-database gives me an error.
>>
>> ! LuaTeX error ...t-beta/texmf-context/tex/context/base/m-database.lua:74: bad argument #2 to 'lpegmatch' (string expected, got nil)
>> stack traceback:
>> [C]: in function 'lpegmatch'
>> ...t-beta/texmf-context/tex/context/base/m-database.lua:74: in function 'process'
>> <main ctx instance>:1: in main chunk.
>> \doprocessdatabase ...ameter \c!command \!!es , }}
>>
>> l.18 \stopMyTable
>>
>>
>> I also, tried the first example of Mojca's CSV May Way (http://dl.contextgarden.net/myway/csv.pdf) which gives me:
>>
>> ! Undefined control sequence.
>> l.36 \startseparatedlist
>> [NaturalTable]
>>
>> Thanks for any suggestions,
>> Florian
>
> Dear Florian,
>
> Hans reimplemented the database module in MKIV. He requested a list of
> problems that I have discovered in new implementation, but apparently
> it's still on his TODO list to resolve them.
replace line 42 in m-database.lua by:
data = buffers.getlines(settings.database)
(internally buffers used to be pre-split but that was changed)
Hans
-----------------------------------------------------------------
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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2010-12-20 16:56 ` Mojca Miklavec
@ 2010-12-20 17:46 ` Florian Wobbe
2010-12-20 21:32 ` Hans Hagen
1 sibling, 0 replies; 11+ messages in thread
From: Florian Wobbe @ 2010-12-20 17:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Dec 20, 2010, at 17:56 , Mojca Miklavec wrote:
> On Sun, Dec 19, 2010 at 20:37, Florian Wobbe wrote:
>> Hi,
>>
>> The example from http://wiki.contextgarden.net/m-database gives me an error.
>>
>> ! LuaTeX error ...t-beta/texmf-context/tex/context/base/m-database.lua:74: bad argument #2 to 'lpegmatch' (string expected, got nil)
>> stack traceback:
>> [C]: in function 'lpegmatch'
>> ...t-beta/texmf-context/tex/context/base/m-database.lua:74: in function 'process'
>> <main ctx instance>:1: in main chunk.
>> \doprocessdatabase ...ameter \c!command \!!es , }}
>>
>> l.18 \stopMyTable
>>
>>
>> I also, tried the first example of Mojca's CSV May Way (http://dl.contextgarden.net/myway/csv.pdf) which gives me:
>>
>> ! Undefined control sequence.
>> l.36 \startseparatedlist
>> [NaturalTable]
>>
>> Thanks for any suggestions,
>> Florian
>
> Dear Florian,
>
> Hans reimplemented the database module in MKIV. He requested a list of
> problems that I have discovered in new implementation, but apparently
> it's still on his TODO list to resolve them.
All right, then. I'll be patient...
Florian
___________________________________________________________________________________
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] 11+ messages in thread
* Re: error with m-database example
2010-12-19 19:37 Florian Wobbe
@ 2010-12-20 16:56 ` Mojca Miklavec
2010-12-20 17:46 ` Florian Wobbe
2010-12-20 21:32 ` Hans Hagen
0 siblings, 2 replies; 11+ messages in thread
From: Mojca Miklavec @ 2010-12-20 16:56 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Hans Hagen
On Sun, Dec 19, 2010 at 20:37, Florian Wobbe wrote:
> Hi,
>
> The example from http://wiki.contextgarden.net/m-database gives me an error.
>
> ! LuaTeX error ...t-beta/texmf-context/tex/context/base/m-database.lua:74: bad argument #2 to 'lpegmatch' (string expected, got nil)
> stack traceback:
> [C]: in function 'lpegmatch'
> ...t-beta/texmf-context/tex/context/base/m-database.lua:74: in function 'process'
> <main ctx instance>:1: in main chunk.
> \doprocessdatabase ...ameter \c!command \!!es , }}
>
> l.18 \stopMyTable
>
>
> I also, tried the first example of Mojca's CSV May Way (http://dl.contextgarden.net/myway/csv.pdf) which gives me:
>
> ! Undefined control sequence.
> l.36 \startseparatedlist
> [NaturalTable]
>
> Thanks for any suggestions,
> Florian
Dear Florian,
Hans reimplemented the database module in MKIV. He requested a list of
problems that I have discovered in new implementation, but apparently
it's still on his TODO list to resolve them.
Mojca
___________________________________________________________________________________
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] 11+ messages in thread
* error with m-database example
@ 2010-12-19 19:37 Florian Wobbe
2010-12-20 16:56 ` Mojca Miklavec
0 siblings, 1 reply; 11+ messages in thread
From: Florian Wobbe @ 2010-12-19 19:37 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
The example from http://wiki.contextgarden.net/m-database gives me an error.
! LuaTeX error ...t-beta/texmf-context/tex/context/base/m-database.lua:74: bad argument #2 to 'lpegmatch' (string expected, got nil)
stack traceback:
[C]: in function 'lpegmatch'
...t-beta/texmf-context/tex/context/base/m-database.lua:74: in function 'process'
<main ctx instance>:1: in main chunk.
\doprocessdatabase ...ameter \c!command \!!es , }}
l.18 \stopMyTable
I also, tried the first example of Mojca's CSV May Way (http://dl.contextgarden.net/myway/csv.pdf) which gives me:
! Undefined control sequence.
l.36 \startseparatedlist
[NaturalTable]
Thanks for any suggestions,
Florian
___________________________________________________________________________________
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] 11+ messages in thread
end of thread, other threads:[~2012-02-16 12:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 15:06 error with m-database example Martin
2012-02-15 20:12 ` Wolfgang Schuster
2012-02-15 20:54 ` Martin
2012-02-15 21:08 ` Wolfgang Schuster
2012-02-16 11:03 ` Martin
2012-02-16 12:16 ` Hans Hagen
-- strict thread matches above, loose matches on Subject: below --
2010-12-19 19:37 Florian Wobbe
2010-12-20 16:56 ` Mojca Miklavec
2010-12-20 17:46 ` Florian Wobbe
2010-12-20 21:32 ` Hans Hagen
2010-12-21 8:20 ` Florian Wobbe
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).