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

Re: [sqr-users] workaround for "BEFORE" outside a BEGIN-SELECT...END-SELECT ?



With On-Break the Procedure is like AFTER.

In your print_data add some code like:
If #First_Time_Flag = 0
    do name_break
    move 1 to #First_Time_Flag
End-if

Regards,
Arnon Oppenheimer
 -------------------------------------------------------------------
SEMECH SOFTWARE MARKETING LTD.
TEL : (972) - 3 - 5333144
FAX : (972) - 3 - 5333132
Email: arnono@semech.co.il
 -------------------------------------------------------------------
----- Original Message -----
From: "Lionel le Marec" <Lionel.Le.Marec@msci.com>
To: <sqr-users@sqrug.org>
Sent: Tuesday, October 29, 2002 1:07 PM
Subject: [sqr-users] workaround for "BEFORE" outside a
BEGIN-SELECT...END-SELECT ?


> Hello,
>
> I would like to display the result of a stored proc using ON-BREAK
> logic.
> My problem is I cannot use "BEFORE" outside a BEGIN-SELECT...END-SELECT,
> which I am not using since I retrieve data from a stored proc.
>
> The stored procedure I use extracts data from Sybase DB.
> Let's say that data extracted represent products, with id, name, code,
> colors and prices.
> One given product has one code, multiple colors and one price for each
> color.
>
> 1    code1    fork    red      10.00
> 1    code1    fork    green  12.00
> 1    code1    fork    blue     11.00
> 2    code2    knife    red        21.00
> 2    code2    knife    green    20.00
> 2    code2    knife    blue       22.00
>
> I want to display something like:
>
> 1    code1    fork
> red      10.00
> green  12.00
> blue     11.00
>
> 2    code2    knife
> red        21.00
> green    20.00
> blue       22.00
>
> but the first set of data would not call the name_break procedure, as
> there is no real break. I will get sth like:
>
>                     fork
> red      10.00
> green  12.00
> blue     11.00
>
> 2    code2    knife
> red        21.00
> green    20.00
> blue       22.00
>
> Can someone help me finding out a work around for "BEFORE" outside
> select statement?
>
> Thx
>
> Lio.
>
> Here are my get_data, print_data, name_break procedures.
>
> begin-procedure get_data ($date)
>     EXECUTE
>       do=print_data
>       on-error=sql_error_handler
>       @#status=get_data
>       @date=$date,
>       into
>        &_id        smallint
>     ,  &_code   int
>     ,  &_name  varchar(20)
>
>     ,  &_color   varchar(20)
>     ,  &_price  float
> end-procedure
>
> begin-procedure print_data
>     let $name    =&name
>
>     let $color   =&color
>     let #price   =&price
>
>     print $name                 (,10)   on-break procedure=name_break
>
>     print $color                (+1,10)
>     print #price                 (,40)
> end-procedure
>
> begin-procedure name_break
>     let #id          =&id
>     let #code    =&code
>     print #id                    (+2,1)
>     print #code                    (,40)
> end-procedure
>
>
> _______________________________________________
> 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