Focal Point
[RESOLVED] &LINE Keeps returning 0

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

February 24, 2012, 04:39 PM
joyesiji
[RESOLVED] &LINE Keeps returning 0
I have this code anytime i run it the &LINES keeps returning zero even though there is a record that is returned. Am i doing something wrong??


TABLE FILE &TABLE_NAME2
PRINT PART
-*ON TABLE HOLD AS &TABLE_NAME2
END
-RUN



-SET &LINES=&LINES;
-TYPE '>>>>>>>>>>>>>>DODO ' &LINES
-IF '&LINES.EVAL' EQ '1' THEN GOTO NODATA;

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


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
February 24, 2012, 04:41 PM
joyesiji
and when i even look at the debug code i see


-RUN
0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1
-SET &LINES= 0;
-TYPE 'LINES' 0


so why is &LINES always 0


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
February 24, 2012, 06:25 PM
Crymsyn
It is always zero because you are setting it to zero. It is a parameter that is automatically set and do not need to set it or define it. Try
TABLE FILE &TABLE_NAME2
PRINT PART
-*ON TABLE HOLD AS &TABLE_NAME2
END
-RUN


-TYPE '>>>>>>>>>>>>>>DODO ' &LINES
-IF &LINES EQ 1 THEN GOTO NODATA;



WF: 8201, OS: Windows, Output: HTML, PDF, Excel
February 24, 2012, 06:25 PM
njsden
quote:

TABLE FILE &TABLE_NAME2
PRINT PART
ON TABLE HOLD AS &TABLE_NAME2
END
-RUN


That would be a weird behaviour, however, I don't know if the fact that you are attempting to write to the same file you're reading from maybe causing WebFOCUS counters to go nuts ...

Can you try writing to a different HOLD file and then show both &LINES and &RECORDS to see what you get?

It would also be nice to know what your EMPTYREPORT setting is.

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



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
February 24, 2012, 06:56 PM
joyesiji
Crymsyn, I am still getting 0 after removing
-SET &LINES=&LINES

njsden i already commented out the
ON TABLE HOLD AS &TABLE_NAME

and i am still getting 0


0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1
-*SET &LINES=&LINES;
-TYPE 'LINES' 0
'LINES' 0
-IF ' 0' EQ '1' THEN GOTO NODATA;


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
February 24, 2012, 07:15 PM
njsden
Do you mind posting your complete piece of code enclosed in
[code] tags?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
February 26, 2012, 12:58 PM
Danny-SRL
Hi,
Could you run the following:
quote:

-* File joyesiji01.fex
TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD
END
-RUN
-TYPE &LINES

Do you get 5?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

February 26, 2012, 01:19 PM
<JG>
&LINES is a reserved variable.

Play with it and it will do strange things.

-SET &whatever = &LINES;

-IF &LINES EQ/NE/GT/LT x GOTO ...

Is about all you can do with it.

Best practice is.

WF Request
-RUN
-SET &your_variable = &LINES;

Do what you need based on &your_variable
February 26, 2012, 02:03 PM
joyesiji
Thanks guy i was able to find out why it was not working , there was a sql query before the code and that sql code contained errors, even though webfocus ran the TABLE FILE correctly and returned one result the &LINES was always 0, once i fixed the sql code then &LINES returned 1, Can i use &RECORDS instead of &LINES


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
February 27, 2012, 01:07 AM
SriAravind
&LINES - Use this when you want to find out how many records are there in the hold file or report.

&RECORDS - Use this when you want to find out the number of records read from the database.


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
March 02, 2012, 04:19 PM
joyesiji
Resolved


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
March 02, 2012, 04:37 PM
njsden
How?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
March 02, 2012, 04:38 PM
njsden
Oh never mind, I just read your comment from before.

To flag it as resolved, please edit your original post and change it's title prefixing it with [RESOLVED]. That'll do it Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.