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     [SOLVED] Comparision of numeric fields not working as expected

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Comparision of numeric fields not working as expected
 Login/Join
 
Guru
posted
Hi,

I'm comparing the 2 numeric values, when there is a match I want to print the value in the report else blank.

DEFINE FILE US_ALL
XMTC/A64V = IF CNT EQ MID THEN METRICCATEGORY ELSE '';
END

Some of the comparisons are not working.

What could be the issue? Any ideas?

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


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Virtuoso
posted Hide Post
Do the two fields have the exact same format? If not - you need to make them have the same format to compare.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
Step 1 is to not use a reserved word as a variable name. CNT in the middle of that source code is fraught with peril. If it's a database field I'd recommend aliasing it in the master file. I don't think that's your problem here, but you're poking the bear, and there's no good reason to poke the bear.

Step 2, if the number fields are integers, all should work correctly. If they are floats you'll find examples where 1 does not equal 1, because floating point numbers are evil and don't want you to be happy. It will show 1 in the report, but the machine's bit pattern will hold 1.000000000000000001 and you won't get exact equivalence.

Use Decimal values with specified tolerances to make sure you are comparing well-trimmed numbers. Also make sure both are of the same exact format to be sure.

J.

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



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Guru
posted Hide Post
Yes, both are same format.

What I'm trying to do,

TABLE FILE CAR
SUM 
COMPUTE MID/D3 =(CNT.CAR/2); 
BY COUNTRY
SUM 
COMPUTE CTR/D3=IF COUNTRY EQ LAST COUNTRY THEN CTR+1 ELSE 1;
BY COUNTRY
BY CAR
ON TABLE HOLD AS MAIN
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN
DEFINE FILE MAIN
XCOUNTRY/A10=IF CTR EQ MID THEN COUNTRY ELSE '';
END
TABLE FILE MAIN
SUM MID CTR
BY COUNTRY NOPRINT
BY XCOUNTRY
BY CAR
END
-EXIT 

'
I want the XCOUNTRY to get displayed whenever there is a match


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Virtuoso
posted Hide Post
Should

COMPUTE CTR/D3=IF COUNTRY EQ LAST COUNTRY THEN CTR+1 ELSE 1;

be

COMPUTE CTR/D3=IF COUNTRY EQ LAST COUNTRY THEN LAST CTR +1 ELSE 1;

by any chance? If not you'll always get the value 1 since you're summarizing by country. In fact I don't think that will matter. I think CTR will be 1 no matter what you have in your data. You need the second LAST in order to have your numbers count forward from 1.


I use something similar in DEFINE fields for Print reports, where you want the numbering to change every time a sorted field moves to the next value.

The COUNTRY comparison looks fine to me.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Guru
posted Hide Post
Thanks for the follow up John!
Suggested COMPUTE doesn't help me out.

Why 'ENGLAND' and 'FRANCE' is not showing up although it has a match in MID and CTR



I guess, figured it out, it's because of ENGLAND and FRANCE MID values are 1.5 and 0.5 internally, i intentionally rounded off the numbers to get it compare with CTR.

How to overcome this now?

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


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Guru
posted Hide Post
Yes, It's resolved after converting the Decimal to Alpha using FTOA and get it compared. Sweating


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report 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     [SOLVED] Comparision of numeric fields not working as expected

Copyright © 1996-2020 Information Builders