Focal Point
[SOLVED] How to Find if Hold File has no records

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

May 20, 2009, 05:17 PM
Viral
[SOLVED] How to Find if Hold File has no records
Hello,

I am getting error file reading the hold file since hold file had no records.
How to find the no records attribute for hold file so that it can skip the segment and continue to next.

Thanks,

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


WF 7.6.2/ OS WIN2003.
DM 7.6.2
May 20, 2009, 05:32 PM
Doug
The following method should work for you:
TABLE FILE MYFILE
{DO WHATEVER TO GET NO RECORDS}
ON TABLE HOLD AS HOLDFILE
END
-RUN
-IF &RECORDS EQ 0 THEN GOTO NoDataToShow ;
TABLE FILE HOLDFILE
{WHATEVER}
END
-GOTO TheEnd
-NoDataToShow
Display a message if you'd like...
-TheEnd





   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
May 20, 2009, 05:34 PM
Waz
You can also use &LINES


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 22, 2009, 12:05 PM
Viral
THanks All for your responses.

It's worked fine used the &RECORDS.

Thanks !


WF 7.6.2/ OS WIN2003.
DM 7.6.2
May 24, 2009, 11:39 PM
Waz
I would suggest using &LINES, in particular if you use WHERE TOTAL.

TABLE FILE CAR
PRINT COUNTRY
WHERE TOTAL COUNTRY EQ 'USA'
ON TABLE HOLD
END
-RUN
-TYPE RECORDS = &RECORDS
-TYPE LINES   = &LINES


You will notice that &RECORDS = 5 and &LINES EQ 0.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 25, 2009, 06:27 AM
<JG>
Waz is correct,

you should use &LINES because &RECORDS is generated before the WHERE TOTAL is applied
and so it can quite easily return the incorrect value.
May 25, 2009, 04:15 PM
Doug
You're absolutly correct in using "&LINES" instead of "&RECORDS" when using a "WHERE TOTAL". I only took it as far as Viral asked in the original post.