Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] read 10 rows at a time from the loop and add it to end result and loop again
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] read 10 rows at a time from the loop and add it to end result and loop again
 Login/Join
 
Gold member
posted
Hi,
I need to read 10 rows at a time and add the result to end result and loop again another next 10 rows and add it end result until finshis all the rows in the table .I appreacite if any one have suggestion about this issue.
 
TABLE FILE TESTFILE
BY TESTFIELD
WHERE READLIMIT EQ 1000
ON TABLE HOLD AS MASLIST
END
-*=======================================

-SET &LOOPCNT=&LINES;

-SET &I=1;
-REPEAT ENDREPEAT WHILE &I LT &LOOPCNT;
-TYPE I &I


TABLE FILE MAS_LIST
PRINT
         FILENAME_UPPER
WHERE    (ROW_NUM EQ &I.EVAL)
ON TABLE SAVE    AS MASITEM
END
-RUN

-SET  &HLD_FIL_NAME = IF (&I.EVAL) GT 1  THEN 'FINALLST' ELSE 'FEXCOUNT&I.EVAL';

DEFINE FILE FEXDETAILS
   MASFILE/A50='&MSTRNAME';
END
TABLE FILE FEXDETAILS
BY FEX_NAME  AS 'FEXCOUNT'
BY MASFILE
WHERE CODE_LINE CONTAINS  '&MSTRNAME'
ON TABLE HOLD     AS &HLD_FIL_NAME
END
-RUN


-IF &HLD_FIL_NAME EQ 'FINALLST' GOTO SKP_MORE;


TABLE FILE FINALLST
BY  FEXCOUNT
BY  MASFILE
ON TABLE HOLD AS FINALLST
MORE
FILE FEXCOUNT&I.EVAL
END

-SKP_MORE


-SET &I=&I+1;

-ENDREPEAT1

TABLE FILE FINALLST
PRINT *
ON TABLE PCHOLD FORMAT HTML
END








 

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
 
Posts: 72 | Registered: April 06, 2016Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Your code does not make sense for me (at least partially).

You are doing TABLE FILE MAS_LIST to SAVE to a file that is not used

How does ROW_NUM is defined ? With this code you will SAVE AS MASITEM as many time you loop and this for nothing

You filter WHERE CODE_LINE CONTAINS '&MSTRNAME' where &MSTRNAME is not defined anywhere

You have no where something that can limit to 10
You may need a loop in a loop


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2191 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I'm at a loss how this is a spec for a BI platform. Could you share the use case for this?


WebFOCUS 8206, Unix, Windows
 
Posts: 1677 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
Sorry for Mistype. Right now i am reading 1 row but my request is read 10 row at a time instead of 1 row.

   TABLE FILE TESTFILE
PRINT
COMPUTE ROW_NUM/I3 = ROW_NUM + 1;
BY TESTFIELD
WHERE READLIMIT EQ 1000
ON TABLE HOLD AS MAS_LIST
END
-RUN


WebFOCUS 8
Windows, All Outputs
 
Posts: 72 | Registered: April 06, 2016Reply With QuoteReport This Post
Gold member
posted Hide Post
By reading 10 rows at a time are you meaning instead of having just one row per loop when doing
 WHERE (ROW_NUM EQ &I.EVAL)
ON TABLE SAVE    AS MASITEM

You would want 10 rows at a time?

If that is the case can instead of using ROW_NUM can divide ROW_NUM by ten and use that to limit instead. so something like this
COMPUTE ROW_NUM_GROUP/I3 = (ROW_NUM-1)/10;

Would ignore the remainder and only have 0 - 99. (The -1 is so that the first group will have ten instead of nine values)
That way the save file would have ten rows instead of one in each iteration of the loop if you change there WHERE to look at that group compute instead.
WHERE (ROW_NUM_GROUP EQ &I.EVAL)

Forgot to also mention will need to divide how you get the value for &LOOPCNT by 10 as well or will loop too many times.

If is more getting ten values onto one line to be able to use a -READ to read all ten at once would need an additional field as above that would use the MOD function and do an across value to put it into something like FILENAME_UPPER1, FILENAME_UPPER2, FILENAME_UPPER3, etc. If only working with hold/save files or that isn't what you would be wanting can ignore using the MOD function.


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Would you please explain your expected results...
It sounds like you'll get all the rows in the table anyway. Are you expecting to see only Ten Rows on the screen at a time? If so, consider LINES-PER-PAGE / Pagination (Basic WebFOCUS functionality)
quote:
and add it end result until finshis all the rows in the table


   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Most recent: 8204 Gen 48 in Test and Production.
   Currently Available. Please contact me.
 
Posts: 3020 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] read 10 rows at a time from the loop and add it to end result and loop again

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.