Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     function to make null values a 0

Read-Only Read-Only Topic
Go
Search
Notify
Tools
function to make null values a 0
 Login/Join
 
Platinum Member
posted
I have a define in my report:

DEFINE FILE RCRAPP1
ASSETS_IND/I1=
IF RCRAPP1_AIDY_CODE EQ '&AID_YEAR' AND ((RCRAPP1_PAR_CASH_AMT + RCRAPP1_CASH_AMT + RCRAPP4_PAR_INV_NET_WORTH 
+ RCRAPP4_INV_NET_WORTH + RCRAPP4_PAR_BUS_NET_WORTH + RCRAPP4_BUS_NET_WORTH) LT 100000) THEN 1
ELSE 0;
END


PROBLEM: if the values for any of the fields (e.g. RCRAPP1_PAR_CASH_AMT) in the summation is null, then the end result is always a 0 and never a 1.

Is there a function that I can use with these fields that will return a zero value when it pulls the field instead of a null value?

I know that I can create a single define for each field (e.g. RCRAPP1_PAR_CASH_AMT) that i use in other defines, but I was hoping for a more efficient way of doing this.

Brian


-Brian

Webfocus v7.6.1 on Windows XP
 
Posts: 108 | Registered: June 19, 2006Report This Post
Virtuoso
posted Hide Post
What you could do is to first collect all needed fields and store them in a hold file using the holdmiss=off setting.
Next you can do your defines against this hold file where now all fields are by definition not-missing and filled with 0 iso null.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
I would try this

DEFINE FILE RCRAPP1
ASSETS_IND/I1=
IF RCRAPP1_AIDY_CODE EQ '&AID_YEAR' AND ((1*RCRAPP1_PAR_CASH_AMT + 1*RCRAPP1_CASH_AMT + 1*RCRAPP4_PAR_INV_NET_WORTH 
+ 1*RCRAPP4_INV_NET_WORTH + 1*RCRAPP4_PAR_BUS_NET_WORTH + 1*RCRAPP4_BUS_NET_WORTH) LT 100000) THEN 1
ELSE 0;
END



It might help.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Master
posted Hide Post
quote:
DEFINE FILE RCRAPP1
ASSETS_IND/I1=
IF RCRAPP1_AIDY_CODE EQ '&AID_YEAR' AND ((RCRAPP1_PAR_CASH_AMT + RCRAPP1_CASH_AMT + RCRAPP4_PAR_INV_NET_WORTH
+ RCRAPP4_INV_NET_WORTH + RCRAPP4_PAR_BUS_NET_WORTH + RCRAPP4_BUS_NET_WORTH) LT 100000) THEN 1
ELSE 0;
END


Problem is in rdbms (stupidity**stupidity)

Value + null = null (something add nothing is nothing)

In wf (sensible option)

Value + null = Value (something add nothing is something)

The problem you have is that the calc is passed to the rdbms and done there.

To prevent this

DEFINE FILE RCRAPP1
ASSETS_IND/I1= IF EDIT('A','9') EQ 'B' THEN -1
 ELSE IF RCRAPP1_AIDY_CODE EQ '&AID_YEAR' AND ((RCRAPP1_PAR_CASH_AMT + RCRAPP1_CASH_AMT + RCRAPP4_PAR_INV_NET_WORTH 
+ RCRAPP4_INV_NET_WORTH + RCRAPP4_PAR_BUS_NET_WORTH + RCRAPP4_BUS_NET_WORTH) LT 100000) THEN 1
ELSE 0;
END



The IF EDIT('A','9') EQ 'B' THEN -1 is there to purely disable optimization since it uses a wf function EDIT. It will never be executed and the result of the expression still applies.

However the result will be calculated by wf and not the rdbms and thus will give you the correct result you desire!

We are waiting for SQL to catch up with wf!



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Platinum Member
posted Hide Post
Thanks everyone for your ideas. The forum went down after I posted, and I had another idea after a while.

Assuming there aren't any negative values, I was able to use abs(field_name) in my define and that seemed to work.

I do like the (1*field_name) option, and I'll try the edit option too.

Thanks!


-Brian

Webfocus v7.6.1 on Windows XP
 
Posts: 108 | Registered: June 19, 2006Report This Post
Master
posted Hide Post
The abs worked because wf did the calculation instead of the rdbms, because abs is a wf function not supported on the rdbms.

Inadvertently you've stumbled on my solution!



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Master
posted Hide Post
You can cheat and use SET NODATA = 0, but that will set all missing fields to 0.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     function to make null values a 0

Copyright © 1996-2020 Information Builders