This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
Peter,

At a glance, I believe the problem you're having is that START_ROW_NUM is
going to get set to "1" every time the page is loaded because of it being a
global variable. Instead, add code like:

%IF(START_ROW_NUM=="")
  @DTW_ASSIGN(START_ROW_NUM,"1")
%ENDIF

...in your %HTML(macro1) block so that it doesn't get reset inadvertantly.
You'll need to pass the variable to your SQL block since it won't be global
anymore.

HTH...

-----Original Message-----
From: Peter Dow [mailto:maillist@dowsoftware.com]
Sent: Tuesday, August 20, 2002 3:17 PM
To: web400@midrange.com
Subject: Re: [WEB400] Net.data START_ROW_NUM with SELECT WHERE clause


Hi Anton, Bleddyn,

Thanks for the replies.  I checked the Ignite example, and it's not quite
what I have, so here's the code.  I've stripped out some of the
non-essential stuff to keep it shorter.

---------------
%DEFINE RPT_MAX_ROWS ="20"
%DEFINE START_ROW_NUM ="1"

%FUNCTION(DTW_SQL) SearchResults() {
SELECT * FILE1 left outer join FILE2
    on ACCT1 = ACCT2
 WHERE @SQLwhere()
 ORDER BY NAME, ACCT1

%REPORT{
    @DTW_ADD(START_ROW_NUM,RPT_MAX_ROWS,next_row_num)
    @DTW_SUBTRACT(START_ROW_NUM,RPT_MAX_ROWS,prev_row_num)
    @DTW_SUBTRACT(next_row_num,"1",last_row)
    @DTW_ASSIGN(NbrAcctsFound,$(TOTAL_ROWS))
    Select an account:
    Reporting rows $(START_ROW_NUM) through $(last_row)
    <table border=3 cellspacing=0 cellpadding="3" width=90%>
    <tr>
        <th>ROW</th>
        <th>ACCT</th>
        <th>NAME</th>
    </tr>

%ROW{
    <tr>
        <td align=center>$(ROW_NUM)</td>
        <td align=center>$(V_ACCT)</td>
        <td align=left>$(V_NAME)</td>
    </tr>
%}
</table>

<p>
%IF (START_ROW_NUM > RPT_MAX_ROWS)
    <a href="/cgi-bin/netdatamacros.dtw/macro1?ACCT=$(ACCT)&Name=$(Name)&
START_ROW_NUM=$(prev_row_num)">PREVIOUS</a>|||
%ELSE
    PREVIOUS |||
%ENDIF

%IF (next_row_num < TOTAL_ROWS)
    <a
href="/cgi-bin/netdatamacros.dtw/macro1?ACCT=$(ACCT)&Name=$(Name)&START_ROW_
NUM=$(next_row_num)">NEXT</a>
%ELSE
    NEXT
%ENDIF
</p>
%}
%}
---------------

The HTML this generates has the correct START_ROW_NUM for the 2nd page, i.e.

http://xyz.com/cgi-bin/netdatamacros.dtw/macro1?ACCT=&NAME=test&START_ROW_NU
M=21

yet clicking on this link brings up the 1st page again.  Is it because of
the global definition of START_ROW_NUM?  I was under the impression this was
a Net.Data defined variable, but if I leave that off, I get "Error Number
4001".

Peter Dow
Dow Software Services, Inc.
909 793-9050 voice
909 522-3214 cellular
909 793-4480 fax



_______________________________________________
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/web400
or email: WEB400-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
NOTICE:  This E-mail may contain confidential information.  If you are not
the addressee or the intended recipient please do not read this E-mail and
please immediately delete this e-mail message and any attachments from your
workstation or network mail system. If you are the addressee or the intended
recipient and you save or print a copy of this E-mail, please place it in an
appropriate file, depending on whether confidential information is contained
in the message.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.