Focal Point
[Solved] GET 0 IS COUNT IS 0

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

June 13, 2012, 04:40 PM
Rafael.AZ
[Solved] GET 0 IS COUNT IS 0
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
June 13, 2012, 04:47 PM
susannah
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
June 13, 2012, 04:50 PM
Rafael.AZ
quote:
-SET &STORE_COUNT = &LINES ;

That did it! Thanks a lot Susannah !


WebFocus 768
Windows, all output
June 18, 2012, 04:14 PM
Darin Lee
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
June 18, 2012, 04:21 PM
Doug
Good One Good One
quote:
"Initialize it upfront" and "On a related note"

June 18, 2012, 04:24 PM
susannah
woulda been READ.... .A5 anyway, not .I5
sigh.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID