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] FORMULA USING FTOA AND ALPHANMUMERIC FIELDS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] FORMULA USING FTOA AND ALPHANMUMERIC FIELDS
 Login/Join
 
Platinum Member
posted
Everyone,

I am near the end of a project. I have two final components to solve. I am hoping someone on the forum might have an idea as to how to solve on of them.

Here is my question: I have a rolling five years of data. My users select the last year and then they get to see that year, plus the previous five years.

At the end, we want to calculate two percentages of change.

The first one (PCTCHG1F) is basically the last year minus the previous year. If either field is 0, then it is masked and the formula provides a dash. Otherwise, the calculated percentage (from an earlier table) displays nicely.

That formula works beautifully.

The second formula (PCTCHG5F) does not work as well. It should be the current year minus the first year. If either the values of the first year and last year result in zeroes, they are masking appropriately with the caret. However, if the first year has a value but the last year is masked with a caret, the formula should behave just like the first formula and result in a dash. It's not.

I've tried using FST.

Is there a better way to do this? As an aside, I separated the COMPUTE statements below for ease in reading.

[CODE] TABLE FILE JDATA
PRINT
COUNTS3
PCTCHG1
PCTCHG5
SORT_GROUP2
SORT_GROUP
SORT_CATEGORY
CATEGORY
YR

COMPUTE ALPHAC/A15=FTOA(COUNTS3,'(D11)','A15');
COMPUTE ALPHAC_F/A15 =IF COUNTS3 EQ '0' THEN '^' ELSE ALPHAC;

-*Note the LAST takes into account the value for the max year less one. In other words, it returns the previous year's data correctly.

COMPUTE PCTCHG1ALPHA/A15=FTOA(PCTCHG1,'(D11.1%)','A15');
COMPUTE PCTCHG1F/A15 =IF LAST ALPHAC_F EQ '^' THEN '-' ELSE IF ALPHAC_F EQ '^' THEN '-' ELSE PCTCHG1ALPHA;

-*Is there a better way to account for the first instance of ALPHA_C_F? I am getting a value of 0% when the first value is masked. I want a dash when either the first year or last year is masked. I only want percentages when both have values.

COMPUTE PCTCHG5ALPHA/A15=FTOA(PCTCHG5,'(D11.1%)','A15');
COMPUTE PCTCHG5F/A15 =IF FST.ALPHAC_F EQ '^' THEN '-' ELSE IF ALPHAC_F EQ '^' THEN '-' ELSE PCTCHG5ALPHA;

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


WebFocus 8.2.04
WebFocus 8.2.04

 
Posts: 191 | Registered: September 18, 2015Report This Post
Guru
posted Hide Post
FST only works in SUM, you could work around this by splitting data in a DEFINE e.g. IF YEAR EQ &firstYear THEN VALUE ELSE MISSING;


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Virtuoso
posted Hide Post
An option is also not to try to do all in one step.

First, create the data as you need but with real numbers. Even if you have too many columns and non desired one, it's not important since it's an temp-step.
Second, use step one result to then add the masking option and only keep desired columns.

Often, trying to do all in one step make it more confusing and difficult to accomplish.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
Thank you both.

As to the suggestions: In the end, my solution utilized a missing component higher up in my procedure and then I continued it down below in the section I was asking about.

Again, thank you both. Something each of you said made the light bulb go off in my head

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


WebFocus 8.2.04
WebFocus 8.2.04

 
Posts: 191 | Registered: September 18, 2015Report 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] FORMULA USING FTOA AND ALPHANMUMERIC FIELDS

Copyright © 1996-2020 Information Builders