Focal Point
&LINES IS 0

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

June 20, 2006, 09:02 AM
funsutton
&LINES IS 0
I am trying to display the number of lines on my report, but I am getting 0 when I use the &LINES parameter. I've been searching this forum for a while, and found nothing that works. What am I doing wrong? I am using Webfocus Developer Studio v. 7. I am using report painter to create this report.

TABLE FILE FORM
SUM 
     CNT.FORM_FUND_CODE AS 'ROWS'
PRINT 
     FORM_SSN
     FORM_LAST_NAME AS 'LAST_NAME'
     FORM_FIRST_NAME AS 'FIRST_NAME'
     FORM_APPROVE_AMT/D12.2CM AS 'APPROVE_AMT'
     FORM_SUB_DATE AS 'SUB_DATE'
     FORM_APP_PHASE_CDE AS 'APP_PHASE_CDE'
     FORM_LNST_CODE AS 'LNST_CODE'
     FORM_EL_STATUS AS 'EL_STATUS'
     FORM_FUND_CODE AS 'FUND_CODE'
ON TABLE SUBFOOT
"&LINES"
WHERE FORM_AIDY_CODE EQ '&AID_YEAR';
WHERE FORM_EL_STATUS EQ 'S';
WHERE NOT FORM_LNST_CODE IN ('DENY','CNCL','CANC');
WHERE FORM_FUND_CODE IN ('FSUBST', 'FUNSUB', 'FPLUSL');
ON TABLE SET PAGE-NUM OFF 
ON TABLE SET BYDISPLAY ON 
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
YADAYADAYADA
END STYLE
END



-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 09:24 AM
<JG>
&LINES does not get populated until after the report is run and
will always be 0 during execution.

Try the following
  
TABLE FILE CAR
SUM CNT.MODEL NOPRINT
COMPUTE LINES/I5=C1; NOPRINT
BY CAR
PRINT MODEL
BY CAR
ON CAR SUBFOOT
"<ST.LINES"
END

This message has been edited. Last edited by: <JG>,
June 20, 2006, 10:00 AM
funsutton
That worked.

Thanks,

Brian

This message has been edited. Last edited by: funsutton,


-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 10:23 AM
Leah
Are you familiar with the internal matrix in focus reporting? When you use sum cnt.....
by ....
the cnt field is assigned a column name in the internal matrix. In this case C1 as JG posted contains a count of models after returning the internal matrix from the sort. As computes are always performed after sorting, the field now contains the line count so to speak. How you use the count is up to you in the report.


Leah
June 20, 2006, 12:37 PM
funsutton
Thank you Leah. I am just learning to use WebFocus, so I am not familiar with the internal matrix. What you said helps me understand a little better.

Thanks,
Brian


-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 12:45 PM
Francis Mariani
Simply stick a -RUN command after the END statement. The report runs and &LINES is populated.

As a rule, I always have a -RUN command after every DEFINE JOIN and END statement.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 20, 2006, 12:50 PM
Leah
Your welcome, Brian, I've been using Focus/WebFocus for years and I still learn something new almost weekly.

And interesting comment Francis, I hardly ever use -RUN, it's a technique to be sure the internal stack is clear as I understand it by doing so may help the code to execute 'better'. Correct me if I'm wrong please and thank you.


Leah
June 20, 2006, 12:57 PM
funsutton
Francis, I am not sure in practicality how to use your suggestion. I did put the -RUN after my end statement, however the &LINES (without the compute statement) still gives a 0.

I guess, what doesn't make sense to me, is that if you are putting a variable (amper or not) in the document Report Footer, then why wouldn't it wait to assign the Report Footer area once the report is complete. Kinda like a compute statement is done once the report is complete.

Brian


-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 01:09 PM
Leah
Brian, see JG's originally comment, &RECORDS, &LINES and so on, values are generated after a reporting step is run (after the END produces and output). Thus during the report execution, the value of the field is a zero. Also if your report did have zero lines without using SET EMPTYREPORT ON you wouldn't see any thing. With it on and there are no records only thing ususally displayed is the heading lines.


Leah
June 20, 2006, 01:16 PM
funsutton
Yeah, I do get that. It makes sense that they would populate once the report is complete. I would just think that webfocus wouldn't do the report footer until the report completed. But, that's just my logic (which is probably immeasureably flawed).

The compute does work for me. Seems like extra work, but it does the job. Francis's idea sounds good, but I didn't get that to work. Adding the -RUN didn't work any miracles for me.

brian


-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 01:56 PM
funsutton
So, after talking with a focus developer on campus, my final code looks like this. It's very similar to what JG gave me ealier. And of course the Sum CNT has to be in this one.

TABLE FILE FORM
SUM 
     CNT.FORM_FUND_CODE NOPRINT
PRINT 
     FORM_SSN
     FORM_LAST_NAME AS 'LAST_NAME'
     FORM_FIRST_NAME AS 'FIRST_NAME'
     FORM_APPROVE_AMT/D12.2CM AS 'APPROVE_AMT'
     FORM_SUB_DATE AS 'SUB_DATE'
     FORM_APP_PHASE_CDE AS 'APP_PHASE_CDE'
     FORM_LNST_CODE AS 'LNST_CODE'
     FORM_EL_STATUS AS 'EL_STATUS'
     FORM_FUND_CODE AS 'FUND_CODE'

COMPUTE LINECNT/I5 = LINECNT + 1; 
ON TABLE SUBFOOT
"ROWS RETURNED: <LINECNT"

WHERE FORM_AIDY_CODE EQ '&AID_YEAR';
WHERE FORM_EL_STATUS EQ 'S';
WHERE NOT FORM_LNST_CODE IN ('DENY','CNCL','CANC');
WHERE FORM_FUND_CODE IN ('FSUBST', 'FUNSUB', 'FPLUSL');
ON TABLE SET PAGE-NUM OFF 
ON TABLE SET BYDISPLAY ON 
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
YADAYADAYADA
END STYLE
END

This message has been edited. Last edited by: funsutton,


-Brian

Webfocus v7.6.1 on Windows XP
June 20, 2006, 02:08 PM
<JG>
Basic rule with &LINES, &RECORDS etc.

They are assigned after the process and not during.

-RUN executes the stack and forces population of system variables
and ALSO processes other commands such as FILEDEF.

The effect is dependant on the version of WebFocus you are using
and in the latest releases -RUN is not so important,
WebFocus seems to have become more intelligent.


For example Pre 71x

FILEDEF XX DISK xx.fex
TABLE FILE CAR
PRINT
COMPUTE MODELQ/A26=''' | MODEL ''';
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE
END
TABLE FILE CAR
PRINT MODEL
WHERE MODEL IN FILE SAVE
END

WILL NOT WORK

While

FILEDEF XX DISK xx.fex
-RUN
TABLE FILE CAR
PRINT
COMPUTE MODELQ/A26=''' | MODEL ''';
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE
END
-RUN
TABLE FILE CAR
PRINT MODEL
WHERE MODEL IN FILE SAVE
END

WILL WORK
June 20, 2006, 02:15 PM
Francis Mariani
Sorry, I didn't notice that &LINES was being used in the FOOTING. I'm glad other people suggested better ideas.

Cheers.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server