[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 ?



        This is a manual break.  It will work for your first values and any
other
         breaks. You may have to modify it to meet your exact needs.

                  let $name    =&name

                   if $name <> $last_$name

                       let $last_$name = $name

                     do name_break

                  end-if
        ____________________________________________
        Ken Katchur
        Information & Technology Services 
        Saskatchewan Social Services
        Tel (306) 787-0362
        Email: Ken.Katchur@govmail.gov.sk.ca



        From:   Lionel le Marec <Lionel.Le.Marec@msci.com> on 10/29/2002
05:07 AM
        Please respond to sqr-users@sqrug.org@SMTP@Exchange
        To:     sqr-users@sqrug.org@SMTP@Exchange
        cc:      
        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