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]Computed field name same as SQL field name

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved]Computed field name same as SQL field name
 Login/Join
 
Member
posted
My experience with webfocus is somewhat limited. I came across something that I'm not sure is a bug in webfocus or not so I would like to know if anyone has ever experienced this before.

We have a SQL pass through statment with some field values and then we also have the same field value in a compute statement. When the results were printed in the report, they end result was sporadic. After investigating I was able to determine thate the column was displayed twice in the hold file.

Example:

SQL SQLORA PREPARE SQLOUT FOR
select amount, dr_cr_indicator
from table_name
where something = true
END

TABLE FILE SQLOUT
PRINT
COMPUTE AMOUNT/D22.2 = IF DEBIT_CREDIT_INDICATOR EQ 'D' THEN (AMOUNT * -1) ELSE AMOUNT;
END
ON TABLE HOLD AS TRANDET

If you do a Print * for TRANDET, you will see the amount column twice, once without the negative sign and once with the negative sign. I'm guessing that webfocus doesn't like the fact that the computed field has the same name as the field value.

Any thoughts or opinions from anyone are appreciated.

Thanks!

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


Webfocus 7.7.2
Windows, HTML, PDF, and Excel
 
Posts: 18 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
I would not treat that as a bug in WebFOCUS. It is *your code* which is creating new fields with the same name as those in the original source.

By default, WebFOCUS will propagate any field "used" in a request (regardless of whether or not it is being printed) to the HOLD file.

That means that the TRANDET HOLD file should have the following fields in it:

- AMOUNT (the one from the DB used in the COMPUTE expression)
- DEBIT_CREDIT_INDICATOR (also used in the COMPUTE expression)
- AMOUNT (you're computed one).

Even though they have the same name, each has a different alias (E01, E02, etc.) so you could pick the one you need using the alias name.

However, if you require not to have the original AMOUNT field in the HOLD, you can influence how WebFOCUS will do that by:

SET HOLDLIST = PRINTONLY


That way, only the compute'd AMOUNT will be in the HOLD file, because it is the only field that would show up in a report if you commented out the ON TABLE HOLD line in the request!

That's actually one of the default settings in my reporting environment but that's because of personal preference.

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



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
The PRINT * will print all fields in the SQLOUT hold file.

You have created another field called the same name, its as simple as that.

If you don't want the duplicate names, then specify the fields you need, or change the COMPUTE column name.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Whenever you have a COMPUTE, a row-based value, those columns within the COMPUTE will be included in the HOLD file. The same goes for CNT., CNT.DST., MAX., etc...
Additionally, COMPUTE is most often utilized with SUM; if you are going to PRINT, put it in a DEFINE...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
Thanks for your replies. I figured it was related to duplicate field names and not a bug. I learn a little more every day!

Thanks again...


Webfocus 7.7.2
Windows, HTML, PDF, and Excel
 
Posts: 18 | Registered: February 23, 2011Report This Post
Platinum Member
posted Hide Post
Try adding this to your TABLE FILE:

ON TABLE SET HOLDLIST PRINTONLY

EricH
 
Posts: 164 | Registered: March 26, 2003Report This Post
Member
posted Hide Post
Thanks for all the replies. I tested the ON TABLE SET HOLDLIST PRINTONLY and that took care of the duplicate fields.


Webfocus 7.7.2
Windows, HTML, PDF, and Excel
 
Posts: 18 | Registered: February 23, 2011Report 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]Computed field name same as SQL field name

Copyright © 1996-2020 Information Builders