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 have numeric values being returned from a database. Values whch are NOT to be displayed are returned as -999999.00 so I am setting these as MISSING in a DEFINE.
The requirement is then to show these values as '-' instead of blank, but to show the numerics as the actual values. This is easy enough when the output format is HTML (SET NODATA = '-'), but the output format is EXL2K.
I have tried every combination possible to effect this from DEFINES to COMPUTES to STYLESHEET settings.
I can't redefine the MISSING to an alpha because it is incompatible with the field format in the case where the numeric is valid.
I've used FTOA, but then the result is non-numeric in Excel and that is not desirable.
I am here as a last resort. Has anyone been able to display an ALPHA or a NUMERIC in the same DEFINE field and have the NUMERIC be treated as such in EXCEL?
Code sample:
DEFINE FILE MYFILE FIELD1/D7.2 MISSING ON=IF FIELD1 LT -100 THEN MISSING ELSE FIELD1 * 100; END
Now what?
Many thanks in advance.This message has been edited. Last edited by: Kerry,
Look for "Applying Dynamically Formatted Virtual Fields to Report Columns" in the Creating Reports With WebFOCUS Language documentation. The format of a report field can be based on an if-then-else expression...
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Francis, thanks for the suggestion, but a numeric can not be reformatted to a non-numeric using that method. Dynamic formatting allows you to specify different NUMERIC formatting to the same numeric field.
I need to say NEWFIELD/[format]=IF [numeric-field] EQ -9999999 THEN '-' ELSE [numeric-field];
DEFINE FILE CAR
XR1_COST/P9.2C = IF COUNTRY EQ 'JAPAN' THEN RETAIL_COST * (-1) ELSE RETAIL_COST;
XR2_COST/A12 = IF XR1_COST LT 0 THEN '-' ELSE PTOA(XR1_COST,'(P9.2C)', XR2_COST);
END
TABLE FILE CAR
PRINT
CAR
DEALER_COST
XR1_COST
XR2_COST
RETAIL_COST
BY COUNTRY
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,
COLUMN=N5,
JUSTIFY=RIGHT,
$
ENDSTYLE
END
-EXIT
Tom, I've been down that road, too. The issue is that they want the NUMERICS in Excel treated as such so they can manipulate them using standard calculations but also want blanks represented as '-'.
This method treats the result as TEXT.
"You can not do this using WebFOCUS" is an acceptable answer.
Tom, I do not post to this forum often because I research items thoroughly before I ask questions and am usually able to find the answers by either searching through Focal Point or by reading the manuals. I know that's a novel concept.
If you can show me how you are able to generate the column XR2_Cost as a NUMERIC and have it treated as such in Excel without manipulating it via that application, I will chalk your comments up to a miscommunication.
JG, Thank you. It's been my experience that you can pretty much do anything with WebFOCUS if you code it properly. I wanted to make sure I wasn't missing something before turning my attention to the Microsoft side of things.
Tom's example works and can do numeric calculations on the XR2_COST field in Excel even with Excel thinking it is string format as long as it isn't the dash.
This approach may produce the desired output, but raises other issues regarding the Excel grid lines.
SET NODATA = '-'
-*
DEFINE FILE CAR
DL_COST/D12.2 MISSING ON = IF COUNTRY EQ 'FRANCE' THEN MISSING ELSE DEALER_COST ;
END
-*
TABLE FILE CAR
SUM DL_COST
BY COUNTRY
ON TABLE HOLD FORMAT HTMTABLE
END
-*
SET HTMLFORMTYPE=XLS
-RUN
-*
-HTMLFORM BEGIN
!IBI.FIL.HOLD ;
-HTMLFORM END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007