Report Writer with Tabs

Juan Antonio Gonzalez Ramos wrote:

>         I need write tab ( \t ) characters in my detail line of my report (written
> for CA-Report Writer).
>
>         Can I do it ?
>
>         Anybody can help me ?
>
>            //////
>           ( o o )
>    +--.oooO--(_)--Oooo.--------------------------------------+
>    |                                                         |
>    |   Juan Antonio González Ramos                           |
>    |     Servicios Informáticos  C.P.D, Gestión Académica I  |
>    |     Edificio Facultad de Derecho. Campus Unamuno        |
>    |     Universidad de Salamanca    Tf: 294400  Ext: 1394   |
>    |                                 Fax: +34 (923) 294594   |
>    |    .oooO                                                |
>    |    (   )   Oooo.                juanan@gugu.usal.es     |
>    +-----\ (----(   )----------------------------------------+
>           \_)    ) /
>                 (_/

We are using some odd character seqence in the output from the Report Writer. We then run a sed script to replace this odd character sequence with the \t character.

We use the same technique to trim the trailing spaces on the line.

In our c-program this will look like this:

#define UNIQUE_PADDING   "`??`"
#define LINE_END_PADDING   "`!!`"

      sprintf(h_string, "/bin/sed -e 's/[ ]*%s[ ]*/%s/g' -e 's/%s[ ]*$//' < %s > %s",

              UNIQUE_PADDING, "\t",
              LINE_END_PADDING,
              tmp_report_file_name,
              output_file_name);
      system(h_string);

Our detail part of the Report Writer script will look like this:
.DETAIL
        .PR varchar(col_1) (c0) .PR "`??`"
        .PR varchar(col_2) (c0) .PR "`??`"
        .PR varchar(last_col) (c0)
        .PR "`!!`"
        .NL

Kind regards
Rolf

-
vvvvvvvvv --------------------------------------------------------
 vvvvvvv  Rolf Cohn          Tel.: +47 2263 7658
  vvvvv   Alcatel Telecom    Mail: Postbox 310 Řkern, N-0511 Oslo
		
    v -------------------------------------------------------------



	I need write tab ( \t ) characters in my detail line of my report (written
for CA-Report Writer).

	Can I do it ?

This is covered in the Ingres FAQ (available from http://www.naiua.org). 
No one has yet worked out how to do this, though the last time I tried was
several major releases ago, so things may have changed.  I'd be glad to
hear if anyone has cracked this because it is a FAQ.

Often the reason people want to do this is to create a tab-delimited file
to load data into another application.  If this is what you want to do then
you might try creating a table "AS SELECT" containing the required data and
then using the COPY command to write it out to a tab-delimited file.

=================================================================
Roy Hann                            rhann@bkbcs.com
BKB Client/Server (UK) Ltd.         http://www.bkbcs.com
Tel: +44 (0)411 071844              "OpenIngres & Java Solutions"


At 10:28 AM 3/3/98 +0000, Roy Hann wrote:
>Someone wrote:
>>	I need write tab ( \t ) characters in my detail line of my report (written
>>for CA-Report Writer).
>>
>>	Can I do it ?
>

I am pleased to report that the workarounds suggest in the Ingres FAQ do
indeed work now, at least on Solaris with OpenIngres 2.0/9712.  I have
not tried other OpenIngres versions.

In particular I tried:
.QUERY
    SELECT ...,xx=CHAR(x'09'),...

.DETAIL
.PRINT ..., xx(q0), ...

and got a tab in the output file.

FAQ maintainer(s), take note!

Karl R. Schendel, Jr.
K/B Computer Associates   schendel@kbcomputer.com
Ingres and Unix Expertise

NAIUA Member-At-Large     atlarge@naiua.org
Ingres Q & A
Back to William's Home Page

© William Yuan 2000

Email William