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     [Solved] GET 0 IS COUNT IS 0
Go
New
Search
Notify
Tools
Reply
  
[Solved] GET 0 IS COUNT IS 0
 Login/Join
 
Member
posted
I'm using a table file and I want to count the number of stores that match a certain criteria,
the following code works fine if there are at least 1 match, but if the count is 0 it will throw
an error saying there is a missing value for &STORE_COUNT when I expect it returns a 0,


TABLE FILE STORE_CATALOG
PRINT
CNT.STORE_ID AS STORE_COUNT;
WHERE STORE_ID EQ '&store_query'
ON TABLE SAVE AS STORE_COUNT FORMAT ALPHA
END
-RUN
-READ STORE_COUNT &STORE_COUNT.I5.

TYPE &STORE_COUNT

I really need it to return a 0 to set up a flag later on the program, any help will be appreciated.

This message has been edited. Last edited by: Kathleen Butler,


WebFocus 768
Windows, all output
 
Posts: 18 | Registered: June 20, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
1) Initialize it upfront
-SET &STORE_COUNT = 0 ;
TABLE FILE STORE_CATALOG
PRINT
CNT.STORE_ID AS STORE_COUNT;
WHERE STORE_ID EQ '&store_query'
ON TABLE SAVE AS STORE_COUNT FORMAT ALPHA
END
-RUN
-READ STORE_COUNT &STORE_COUNT.I5.

TYPE &STORE_COUNT
or 2) TABLE FILE ...
...
END
-RUN
-SET &STORE_COUNT = &LINES ;




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Member
posted Hide Post
quote:
-SET &STORE_COUNT = &LINES ;

That did it! Thanks a lot Susannah !


WebFocus 768
Windows, all output
 
Posts: 18 | Registered: June 20, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
On a related note - if you were doing any sort of summation, you might need to use &RECORDS instead of &LINES. For a PRINT they would be the same, but for a SUM, &LINES would be the number of aggregated lines while &RECORDS would be the number of individual records in the answer set.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
Good One Good One
quote:
"Initialize it upfront" and "On a related note"
 
Posts: 3034 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
woulda been READ.... .A5 anyway, not .I5
sigh.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved] GET 0 IS COUNT IS 0

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