Re: [NTG-context] issue with t-scancsv.lua

2014-12-10 Thread Pablo Rodriguez
On 12/09/2014 12:45 AM, Jaroslav Hajtmar wrote:
 Hi Pablo.
 I am glad that my library for you to use ...
 I noticed that you have in your CSV file header with column names (ie. 
 head of CSV document). I do not know if you noticed the option put this 
 information into scancsv.lua library. This is done via the command 
 \setheader. In this case library does not consider the first line of the 
 CSV file as a data line.

Hi Jaroslav,

I know that, ubt I removed it in the sample I sent because I edited the
CVS file with gedit and I forgot that the first line was the header (I
was in a hurry).

I actually use \setheader to ignore it, since headers with non-ASCII
characters or spaces are problematic. I’m fine invoking \cA, \cB, \cC...

 From the header of CSV file are now macros (from header names)
 contain later data from rows of the CSV file (changing in cycle). In
 addition, you can also use internal hooks. CSV file can even contain
 macros (must be defined before processing the CSV file).

Well, your sample needs further study. Internal hooks are fine (once I
know what they really are and how to use them ;-)), but macros are
totally out of question. CVS files come from Excel users (I don’t even
mention what TeX or ConTeXt might be).

Many thanks for your help,


Pablo


 Example of use hooks etc. eg. Here:
 
 \usemodule[scancsv]
 
 \setuppapersize[C6, landscape]
 \setuppagenumbering[location=]
 
 % Structure of CSV file - you can use macros in CSV table too
 % name;address;postcode;city;linecolor
 % ME;STREET;;HERE;\green;
 % You;Square;;There;\red;
 % we;another Square;111;anyplace;\blue;
 
 
 % Library is making \name, \address, \postcode, \city and \linecolor macros
 % when you using \setheader command.
 
 % Your example:
 \unexpanded\def\lineaction{
 \edef\lowercasename{\lowercase{\name}}
 \edef\uppercaseaddress{\uppercase{\address}}
 name: {\linecolor\name}\ -- lowercase name: \lowercasename\crlf
 address: \address\ -- upercase address: \uppercaseaddress\crlf
 \postcode\ \city\crlf
 
 \page
 }
 
 
 % My example with hooks:
 \unexpanded\def\tablelineaction{%
  \edef\ehname{\hname}%
  \edef\ehaddress{\haddress}%
  \edef\ehpostcode{\hpostcode}%
  \edef\ehcity{\hcity}%
 \ehname \ehaddress \ehpostcode \ehcity %
 }
 
 % My simple example with hooks:
 \def\simpletablelineaction{%
 \bTD{\linecolor\numline}\eTD\hname\haddress\hpostcode\hcity%
 }
 
 
 \setsep{;} % set separator
 \setheader % set information about header
 \setfiletoscan{mailmergedatatable.csv}
 
 \starttext
 % process all file
 
 Here is begin of processing...
 
 \filelineaction
 
 And here is end
 
 \page
 
 And now we can use internal hooks:
 
 \def\bch{\bTD } % begin column hook
 \def\ech{\eTD} % end column hook
 \def\blinehook{\bTR } % begin line hook
 \def\elinehook{\eTR} % end line hook
 \def\bfilehook{\bTABLE } % begin CSV file hook
 \def\efilehook{\eTABLE} % end CSV file hook
 
 Here is begin of processing...
 
 %process all file too (endless cycle)
 \doloopif{1}{==}{1}{\tablelineaction}
 
 And here is end
 
 \page
 
 Printing only specific data:
 
 \doloopif{\name}{eq}{You}{\tablelineaction}
 
 \page
 
 Simpletablelineaction:
 
 \doloopif{1}{==}{1}{\simpletablelineaction}
 
 \page
 
 Another using of hooks:
 
 \def\bch{\bgroup\linecolor\bf } % begin column hook
 \def\ech{\egroup,\ } % end column hook
 \def\blinehook{Here is new \numline. line of CSV file:\crlf } % begin 
 line hook
 \def\elinehook{\hairline\par} % end line hook
 \def\bfilehook{Here is all CSV file:\blank[2*big] } % begin CSV file hook
 \def\efilehook{\par Here is end of file processing\par} % end CSV file hook
 
 \doloopif{1}{==}{1}{\tablelineaction}
 
 
 
 \stoptext


-- 
http://www.ousia.tk
___
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
___

[NTG-context] issue with t-scancsv.lua

2014-12-08 Thread Pablo Rodriguez
Hello Jaroslav,

I have discovered that it is impossible to change letter cases with
fields imported with t-scancsv.lua.

Here you have a sample:

\usemodule[scancsv]

\setuppapersize[C6, landscape]
\setuppagenumbering[location=]

\unexpanded\def\lineaction{
\lowercase{\cA}\crlf
\uppercase{\cB}\crlf
\cC--\cD\crlf

\lowercase{}\crlf
\uppercase{}\crlf
\page
}

\setsep{;}
\setfiletoscan{mailmergedatatable.csv}

\starttext
\filelineaction
\stoptext

The contents of mailmergedatatable.csv would be:

name;address;postcode;city;
ME;STREET;;HERE;
You;Square;;There;

Would it be a way to avoid this?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] issue with t-scancsv.lua

2014-12-08 Thread Jaroslav Hajtmar

Hello Pablo.
What do you think of this solution:

\usemodule[scancsv]

\setuppapersize[C6, landscape]
\setuppagenumbering[location=]

\unexpanded\def\lineaction{
\edef\lcA{\lowercase{\cA}}
\edef\ucB{\uppercase{\cB}}
cA: \cA -- lowercase cA: \lcA\crlf
cB: \cB -- upercase cB: \ucB\crlf
cC: \cC -- cD: \cD\crlf

\lowercase{}\crlf
\uppercase{}\crlf
\page
}

\setsep{;}
\setfiletoscan{mailmergedatatable.csv}

\starttext
\filelineaction
\stoptext


I greet you

Jaroslav Hajtmar


Dne 8.12.2014 13:38, Pablo Rodriguez napsal(a):

Hello Jaroslav,

I have discovered that it is impossible to change letter cases with
fields imported with t-scancsv.lua.

Here you have a sample:

\usemodule[scancsv]

\setuppapersize[C6, landscape]
\setuppagenumbering[location=]

\unexpanded\def\lineaction{
\lowercase{\cA}\crlf
\uppercase{\cB}\crlf
\cC--\cD\crlf

\lowercase{}\crlf
\uppercase{}\crlf
\page
}

\setsep{;}
\setfiletoscan{mailmergedatatable.csv}

\starttext
 \filelineaction
\stoptext

The contents of mailmergedatatable.csv would be:

name;address;postcode;city;
ME;STREET;;HERE;
You;Square;;There;

Would it be a way to avoid this?

Many thanks for your help,


Pablo


___
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
___

Re: [NTG-context] issue with t-scancsv.lua

2014-12-08 Thread Pablo Rodriguez
Hi Jaroslav,

many thanks for your reply.

It works fine here. Let’s see what I can do tomorrow with the real
documents :-)

Many thanks for your help again,


Pablo


On 12/08/2014 01:56 PM, Jaroslav Hajtmar wrote:
 Hello Pablo.
 What do you think of this solution:
 
 \usemodule[scancsv]
 
 \setuppapersize[C6, landscape]
 \setuppagenumbering[location=]
 
 \unexpanded\def\lineaction{
 \edef\lcA{\lowercase{\cA}}
 \edef\ucB{\uppercase{\cB}}
 cA: \cA -- lowercase cA: \lcA\crlf
 cB: \cB -- upercase cB: \ucB\crlf
 cC: \cC -- cD: \cD\crlf
 
 \lowercase{}\crlf
 \uppercase{}\crlf
 \page
 }
 
 \setsep{;}
 \setfiletoscan{mailmergedatatable.csv}
 
 \starttext
  \filelineaction
 \stoptext
 
 
 I greet you
 
 Jaroslav Hajtmar

-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] issue with t-scancsv.lua

2014-12-08 Thread Jaroslav Hajtmar

Hi Pablo.
I am glad that my library for you to use ...
I noticed that you have in your CSV file header with column names (ie. 
head of CSV document). I do not know if you noticed the option put this 
information into scancsv.lua library. This is done via the command 
\setheader. In this case library does not consider the first line of the 
CSV file as a data line. From the header of CSV file are now macros 
(from header names) contain later data from rows of the CSV file 
(changing in cycle). In addition, you can also use internal hooks. CSV 
file can even contain macros (must be defined before processing the CSV 
file).


I greet you.
Jaroslav Hajtmar

Example of use hooks etc. eg. Here:

\usemodule[scancsv]

\setuppapersize[C6, landscape]
\setuppagenumbering[location=]

% Structure of CSV file - you can use macros in CSV table too
% name;address;postcode;city;linecolor
% ME;STREET;;HERE;\green;
% You;Square;;There;\red;
% we;another Square;111;anyplace;\blue;


% Library is making \name, \address, \postcode, \city and \linecolor macros
% when you using \setheader command.

% Your example:
\unexpanded\def\lineaction{
\edef\lowercasename{\lowercase{\name}}
\edef\uppercaseaddress{\uppercase{\address}}
name: {\linecolor\name}\ -- lowercase name: \lowercasename\crlf
address: \address\ -- upercase address: \uppercaseaddress\crlf
\postcode\ \city\crlf

\page
}


% My example with hooks:
\unexpanded\def\tablelineaction{%
\edef\ehname{\hname}%
\edef\ehaddress{\haddress}%
\edef\ehpostcode{\hpostcode}%
\edef\ehcity{\hcity}%
\ehname \ehaddress \ehpostcode \ehcity %
}

% My simple example with hooks:
\def\simpletablelineaction{%
\bTD{\linecolor\numline}\eTD\hname\haddress\hpostcode\hcity%
}


\setsep{;} % set separator
\setheader % set information about header
\setfiletoscan{mailmergedatatable.csv}

\starttext
% process all file

Here is begin of processing...

\filelineaction

And here is end

\page

And now we can use internal hooks:

\def\bch{\bTD } % begin column hook
\def\ech{\eTD} % end column hook
\def\blinehook{\bTR } % begin line hook
\def\elinehook{\eTR} % end line hook
\def\bfilehook{\bTABLE } % begin CSV file hook
\def\efilehook{\eTABLE} % end CSV file hook

Here is begin of processing...

%process all file too (endless cycle)
\doloopif{1}{==}{1}{\tablelineaction}

And here is end

\page

Printing only specific data:

\doloopif{\name}{eq}{You}{\tablelineaction}

\page

Simpletablelineaction:

\doloopif{1}{==}{1}{\simpletablelineaction}

\page

Another using of hooks:

\def\bch{\bgroup\linecolor\bf } % begin column hook
\def\ech{\egroup,\ } % end column hook
\def\blinehook{Here is new \numline. line of CSV file:\crlf } % begin 
line hook

\def\elinehook{\hairline\par} % end line hook
\def\bfilehook{Here is all CSV file:\blank[2*big] } % begin CSV file hook
\def\efilehook{\par Here is end of file processing\par} % end CSV file hook

\doloopif{1}{==}{1}{\tablelineaction}



\stoptext





Dne 8.12.2014 17:21, Pablo Rodriguez napsal(a):

Hi Jaroslav,

many thanks for your reply.

It works fine here. Let’s see what I can do tomorrow with the real
documents :-)

Many thanks for your help again,


Pablo


On 12/08/2014 01:56 PM, Jaroslav Hajtmar wrote:

Hello Pablo.
What do you think of this solution:

\usemodule[scancsv]

\setuppapersize[C6, landscape]
\setuppagenumbering[location=]

\unexpanded\def\lineaction{
\edef\lcA{\lowercase{\cA}}
\edef\ucB{\uppercase{\cB}}
cA: \cA -- lowercase cA: \lcA\crlf
cB: \cB -- upercase cB: \ucB\crlf
cC: \cC -- cD: \cD\crlf

\lowercase{}\crlf
\uppercase{}\crlf
\page
}

\setsep{;}
\setfiletoscan{mailmergedatatable.csv}

\starttext
  \filelineaction
\stoptext


I greet you

Jaroslav Hajtmar


___
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
___