Focal Point
[SOLVED]NUMBER OF RECORDS IN TABLE vs. LINES

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5107044386

August 15, 2016, 12:54 PM
gcarterIT
[SOLVED]NUMBER OF RECORDS IN TABLE vs. LINES
I have output that includes this:

 0 NUMBER OF RECORDS IN TABLE=       14  LINES=      9 


What's the difference between NUMBER OF RECORDS IN TABLE and LINES?

Thanks.

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 7.6
Windows, All Outputs
August 15, 2016, 01:08 PM
BabakNYC
I think &RECORDS is the variable the contains the number of records the request retrieved.  

&LINES is the variable that contains the number of lines in the answer set.

TABLE FILE CAR
SUM RCOST BY COUNTRY
END

will give you different LINES from
TABLE FILE CAR
PRINT RCOST BY COUNTRY
END

Same number retrieved but different number in the output.




WebFOCUS 8206, Unix, Windows
August 15, 2016, 01:34 PM
gcarterIT
Okay, I think I see. So it seems the LINES value is determined by an aggregate function (SUM) in the query. In your first case, LINE will be the total number of COUNTRY, not the total number of records extracted by the query.

But what if your query has no aggregate function. Why would the numbers be different?

This example is similar to my actual code:

  
TABLE FILE ORDER_PAYMENTS
BY ORDER_KEY AS 'ORDER_NUMBER'
BY CUST_ID AS 'CUST_NUMBER'
WHERE ORDER_DT GE HADD((HGETC(8, 'HYYMDs')), 'DAY', -30, 8, 'HYYMDs');
WHERE INACTIVE_ACCT NE '1' OR INACTIVE_ACCT EQ MISSING;
WHERE ORDER_KEY IN &ORDER_KEY;
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS CUST_ORDERS FORMAT FOCUS INDEX ORDER_KEY
END



Note: &ORDER_KEY is a predetermined list of unique order numbers.

Thanks.


WebFOCUS 7.6
Windows, All Outputs
August 15, 2016, 01:58 PM
BabakNYC
You have a WHERE test. Try the same code without the three WHERE's and you'll probably get the same number of Lines as Records.


WebFOCUS 8206, Unix, Windows
August 15, 2016, 02:22 PM
gcarterIT
You are correct. When I comment the WHERE lines, the numbers are the same.

So it appears, similar to an aggregate function, a WHERE clause will also determine the value of LINES.

Thanks, this helps a lot.


WebFOCUS 7.6
Windows, All Outputs
August 15, 2016, 04:03 PM
Kofi
It might being if WHERE not being translate to SQL. So answer set more big than final lines?

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
August 16, 2016, 09:35 AM
Joni Campbell - Europa Sports
Since there is no verb object included in the request, the output is aggregated by default, since each order number and customer number will only display one time, no matter how many records are extracted for that combination of values.


8009
Windows, HTML, AHTML, Excel
In FOCUS since 1983
August 16, 2016, 10:14 AM
Kevin W
Remember that WebFocus is building an internal matrix. The Records value display the number of records returned from the source. From some sources such as a flat file that could be everything. From other sources such as SQL it is selected data from the source. The Lines value displays the matrix rows to be output as the results of any manipulation to the matrix. As already commented there are multiple reasons why the values may not be the same.


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
August 17, 2016, 09:08 AM
gcarterIT
Thanks Kofi, Joni and Kevin.

I think I got it now:

NUMBER OF RECORDS IN TABLE = total # of records extracted from source

LINES = # number of lines outputted (based on how the extracted records are manipulated by the query)


I will keep this in consideration in the future.

Thanks again.


WebFOCUS 7.6
Windows, All Outputs