As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I've created a define to perform some math on a physical field in my database only when a specific flag is set, otherwise the define should return NULL. For the most part, this works pretty well- the define does return the MISSING value when the flag is not set. However, if I attempt to use the AVE function, I get some strange results back.
Here is my code:
DEFINE FILE PD_WORKORDER_DETAILS
EXCD_APROLOS_DAYS_Q/D12.1BC MISSING ON NEEDS SOME = IF APRO_EXCEED_LOS EQ 'Y' THEN (APRO_LOS_Q - 72)/24 ELSE MISSING ;
END
TABLE FILE PD_WORKORDER_DETAILS
SUM
AVE.EXCD_APROLOS_DAYS_Q
-*CNT.EXCD_APROLOS_DAYS_Q
WHERE WORK_ORD_V.APRO_DAY GE '11292009' AND WORK_ORD_V.APRO_DAY LE '01022010'
WHERE PD_RPT_LOC_V.REF_CO_LOC_I IN (3)
END
-RUN
-EXIT
If I run the above code, I get some monsterous negative number. However, the really bizarre part is that if I uncomment the CNT.EXCD_APROLOS_DAYS_Q line, I get the correct average value of 27.6.
I tried to reproduce this using the CAR file, however the AVE function works correctly there. I suspect there is some sort of glitch in how FOCUS and the SQL Server adapter are handling the NULL values. Has anyone else run into issues getting the AVE aggregation operation to work correctly on SQL Server?This message has been edited. Last edited by: Kerry,
Also issuing the CNT. probably forces the logic to be done by WebFOCUS. For CNT it needs to know if the result is missing or not, to be able to do a correct count. An average can be calculated by the db engine, which apparently does not take the missing of the defined field into account. That's why you get these big negatives - a missing value is represented by a large negative number. Does it also work ok if you do the CNT with a NOPRINT following it?
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007