[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Need help printing 2 values across as 6columns



Well, you could kludge it with a temporary table. Or, you could use
something like the following, which includes some Oracleisms such as
ROWNUM, but which should be transposable:

SELECT a.zip, a.zip_pct, a.old_order, b.one_third,
   mod(a.old_order, b.one_third) as modulus
FROM
  (SELECT zip, zip_pct, rownum - 1 AS old_order
   FROM
     (SELECT zip, ... AS zip_pct
      FROM your_table
      WHERE ....
      GROUP BY zip
      ORDER BY zip)
   ) a,
  (SELECT TRUNC(COUNT(DISTINCT zip)/3) as one_third
   FROM your_table
   WHERE ...) b
ORDER BY modulus, old_order


And this will give you the items you want in 3-up order.

>>> Connie.Hunter@usarec.army.mil 02/26/03 02:36PM >>>
Thanks (I'll keep this bit of info for further projects!) but that's
not
quite what I'm trying to do.  I'm trying to print 6 columns, using only
2
fields: (i.e.:

ZIPCODE PERCENT         ZIPCODE PERCENT         ZIPCODE PERCENT
40121           100%                    41072            99%
40987           100%
40122           100%                    41074            99%
40999           100%
40123            90%                    41076           100%
40500           100%

My results sometimes are as large as 150 rows.  I want to wrap the
info
across the page, rather then printing down the page.  I'm ATTEMPTING to
load
an array n-rows by 6-columns and then print the array.  Any other
suggestions?


Connie

-----Original Message-----
From: the dragon [mailto:ceprn@hotmail.com] 
Sent: Tuesday, February 25, 2003 11:16 AM
To: sqr-users@sqrug.org 
Subject: Re: [sqr-users] Need help printing 2 values across as 6
columns


Connie,

Here is a sample program provided by brio which may help you out some. 
Pay 
attention to the stuff in the begin-procedure phone-list section - you
may
need to massage this some to make it work for your 
application.

good luck.

clark 'the dragon' willis
dragon enterprises consulting **have sqr manual, will travel**

!  Phonelst.sqr   3/26/86   Phone list
!
!  Written by Israel Stern
!
!  This SQR sample report displays names and phone numbers in two ! 
columns
down the page.  Page headings and footings are printed. !  This report
is an
example of how easily SQR handles columns. ! ! Copyright (C) 1994-2000
Brio
Technology All Worldwide Rights Reserved ! ! Disclaimer: ! ! This
program is
provided as an example and, while it is thought to be ! free from
defect,
Brio Technology makes no representations or war- ! ranties, either
expressed
or implied, with respect to the adequacy of ! the program in regard to
merchantability or fitness for any particular ! result.  The program
is
provided "as is" and the entire risk as to ! quality and performance is
with
the buyer.  In no event shall Brio ! Technology be liable for special,
direct, indirect or consequential ! damages resulting from any defect
in
this program.  Some states do not ! allow the exclusion or limitations
of
implied warranties or liability ! for incidental or consequential
damages,
in which case the above ! limitations and exclusions may not apply to
you. !
!***************************************************************************
!
! Modification History:
!
! Date      Eng  Description
! --------  ---  
------------------------------------------------------------
! 11-11-92  GLD  (0169)
!                  o Correct Headers
! (_V2.5.4_)
! 03-23-95  PAB  (DEV-1000)
!                  o Changed 'Sybase, Inc.' to 'MITI' in disclaimer
! (_V2.5.6_)
! 05-13-94  GLD  (DEV-1009)
!                  o Added 'Worldwide' Rights
! (_V3.5.4_)
! 04-03-96  PAB  (DEV-4088)
!                  o Cleaned up the modification history.
! (_V4.1_)
! 07-28-97  BDC  (OH-B006)
!                  o Header modification
! (_V4.3.1_)
! 07-10-98  PAB  (TS-3276)
!                  o Changed date edit mask to be Year 2000 compliant
! (_V6.0_)
! 01-05-00  PAB  (OH-9795)
!                  o Change ending copyright year to 2000.
! (_EOH_)
!***************************************************************************

begin-setup
  page-size 57 80
end-setup

begin-report
  do phone-list
end-report

begin-heading 2
  print 'Acme Paints, Inc.' (1,1,0) center
  date-time (1,1,0) MM/DD/YYYY
  page-number (1,70,0) 'Page '
  print 'Customer Phone List' (2,1,0) center
end-heading

begin-footing 1
  print '(Internal company use only)' (1,1,0) center end-footing


begin-procedure phone-list
  columns 1 41          ! Two columns per page
  move 52 to #colmax    ! Maximum lines per column
  move 0 to #colcount
! We will repeat the same names several times and use an incrementing
!
phone number for this example, to see how several pages would look.
  move 0 to #counter
  move 2163970551 to #telno
  while #counter <= 5
    do phone-numbers
    add 1 to #counter
  end-while
end-procedure


begin-procedure phone-numbers
begin-select

! These dots will be overlaid partially by the name and phone number. 
The !
result will be what looks like a page from a phone book. !
  print '.....................................' (+1,1,0)

name (0,1,21)

  print #telno (0,24,0) edit (xxx)bxxx-xxxx
  add 1 to #telno
  add 1 to #colcount
  if #colcount >= #colmax
     next-column goto-top=1 at-end=newpage   ! Go to top of next column
at 
line
     move 0 to #colcount                     ! 1, after last column
eject
page.
  end-if

from customers order by name      ! A useful directory would be
sequenced
end-select                        ! by last name, of course.
end-procedure




PSA: Salary <> Slavery.  If you earn a salary, your employer is renting
your

services for 40 hours a week, not purchasing your soul.  Your time is
the 
only real finite asset that you have, and once used it can never be 
recovered, so don't waste it by giving it away.

"Time is the coin of your life. It is the only coin you
have, and only you can determine how it will be spent.
Be careful lest you let other people spend it for you."

Carl Sandburg
(1878 - 1967)


----Original Message Follows----

Fyi: I'm using
SQR/6.2.1/PC/Windows NT 4.0/Sybase SDK 12.0/Apr 16 2002

I'm a new user, and need some help.
I am trying to print 2 columns (ZIP Code, Percentage), three-times
across
the page (trying to conserve paper!):

40121 100% 41072 99% 40987 100%
40122 100% 41074 99% 40999 100%
40123 90% 41076 100% 40500 100%

Below is my SQR (I loaded an array, and am trying to print the data),
but it

prints in two loooong columns. The array counts how many
ZIP/Percentages I 
get back, so I can be sure I'm printing them all:
  Do Sub_Query
let #entry_cnt_zip = #z
let #z = 0
while #z <= #entry_cnt_zip
let $zip_cd = data_1301_zip.ZIP_CD(#z)
let $split_qy = data_1301_zip.split_qy(#z)
Print $zip_cd (,72) !printing the zips/splits
Print $split_qy (,78) edit xxx%
Next-Listing Need=1
let #z = #z + 1
end-while


Tanks!

Connie Hunter
US Army Recruiting Command


CJnnie
Connie Hunter
IM - FAZR Analyst
Room 301, Bldg 6579
(502) 626-1093  or 1-800-223-3735 ext 6-1093


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org http://www.sqrug.org/mailman/listinfo/sqr-users 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org 
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users