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     General NUMBER Format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
General NUMBER Format
 Login/Join
 
Gold member
posted
We are trying to get some code written that will let us make the WebFocus code.

I need to do a dynamic calculation that will return either a Count or a Percent. The percent is required to carry 1 decimal and the count 0 decimals. I also need this calculation to be subtotaled via a recompute.

I have looked at the sample code that does this by setting another variable and then doing VAR1/FRM_VAR but I can't duplicate this using the compute and getting my subtotals.

Isn't there a field type that isn't fussy about format that would be equivalent to an Oracle NUMBER field. Why can't I have one decimal in on cell and 8 in another.

Any ideas?


WF 5.3.5 / SOLARS 2.9 / Apache / Tomcat / Oracle (9.2/10g)
 
Posts: 62 | Location: Rochester, NY | Registered: September 30, 2005Report This Post
Virtuoso
posted Hide Post
Try looking here for some insight to formats
http://documentation.informationbuilders.com/masterinde...13crgt/aafldfrm3.htm


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
I read back through the documentation provided on the link and I understand it. I still have a problem however.

The documenation says that my decimal will show up to as many decimals as it can store. My question is how do I get it to show whatever is stored and not just something in the D12.2 format which will bring everything back to 2 decimals.

What I want is a D12.[variable] or somehow do a
COMPUTE VARIABLE_CALC/D12.[variable] = IF CALC_CD EQ 'PERCENT' THEN (NUMERATOR / DENOMINATOR * 100) (note: rounded to 1 decimal)
ELSE IF CALC_CD = 'COUNT' THEN NUMERATOR (note: rounded to nearest whole number)


WF 5.3.5 / SOLARS 2.9 / Apache / Tomcat / Oracle (9.2/10g)
 
Posts: 62 | Location: Rochester, NY | Registered: September 30, 2005Report This Post
Gold member
posted Hide Post
I did see in the documenation that there is such a thing as Zoned Decimals. It appears that is what is used internally but it doens't seem to be something you can access at run-time unless you are spitting it out to a file as an Alpha.

Is there such a thing that exists that takes any number of variable precision and actually just calls a ROUND function etc.?


WF 5.3.5 / SOLARS 2.9 / Apache / Tomcat / Oracle (9.2/10g)
 
Posts: 62 | Location: Rochester, NY | Registered: September 30, 2005Report This Post
Expert
posted Hide Post
Hi Johnny5,

I ran a quick search about Zoned Decimals and came across the following which may be of interest:

How to convert alphanumeric to zoned decimal?

Hope it helps. Smiler

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report This Post
Gold member
posted Hide Post
I don't know if this will help or not... if not, just chunk it.

Anyway... this is a DEFINE FUNCTION I came up with about 4 years ago to do arbitrary precision before WF had the decimal alignment feature.

The output is an A30 field, but it give you the ability to specify ARBITRARY PRECISION with MINIMUM PRECISION define on your output format.

For example:

Assume you needed to always have a minimum of 3 decimal places displayed, but you also need to retain FULL precision for values that have more than 3 decimal places.

COMPUTE NEWFIELD/A30=PRECISN(NUMBER,'(D18.6B)',x);
  
INPUT         Value of 'x'     OUTPUT
20.0097         3              20.0097
20.0            2              20.00
20.0097000      4              20.0097


DEFINE FUNCTION PRECISN (VAL/D20,FMT/A9,SIGNIF/D2)
-* Convert value to Alpha and left justify
  VAL1/A30=TRIM('L',FTOA(VAL,FMT,'A30'),30,' ',1,'A30');
-* Find the first ')' or space (due to memory not being cleared
-* between function calls).
  POS0/I2     =IF (VAL1 CONTAINS '(')
                 THEN
                   POSIT(VAL1,30,')',1,'I2')
                 ELSE
                   POSIT(VAL1,30,' ',1,'I2') - 1;
-* Substring up to POS0 to get our value to work with.
  VAL2/A30=IF (VAL1 CONTAINS '(')
                 THEN
                   SUBSTR(30,VAL1,1,POS0,30,'A30')
                 ELSE
                   SUBSTR(30,VAL1,1,POS0,30,'A30');
-* Find the first '.'
  POS1/I2     =POSIT(VAL1,30,'.',1,'I2') + 1 + SIGNIF;
-* Get the length of the string
  LEN1/I2     =ARGLEN(30,VAL2,'I2');
-* Pull off the last part of the number
-* after the '.' and after the specified significant number of digits.
  LASTPART/A30=IF (VAL2 CONTAINS '(')
                 THEN
                   SUBSTR(30,VAL2,POS1,LEN1 - 1,30,'A30')
                 ELSE
                   SUBSTR(30,VAL2,POS1,LEN1,30,'A30');
-* Trim any zero's at the end of the non-significant digits
  TRIM1/A30 =TRIM('T',LASTPART,30,'0',1,'A30');
-* Create value which will remove the '.' if SIGNIF is 0 and everything right
-* of the decimal is 0.
  RMDEC/I1=IF (SIGNIF EQ 0) AND (TRIM1 EQ ' ') THEN -1 ELSE 0;
-* Put the number back together, include trailing ')' if negative.
  TEMP1/A80   =IF (VAL2 CONTAINS '(') 
                 THEN
                   SUBSTR(30,VAL2,1,POS1 - 1 + RMDEC,30,'A30') ||
                   (TRIM1 || ')')
                 ELSE
                   SUBSTR(30,VAL2,1,POS1 - 1 + RMDEC,30,'A30') ||
                   TRIM1;
-* Output the value.
  PRECISN/A30=SUBSTR(80,TEMP1,1,30,30,'A30');
END
  
 
Posts: 21 | Location: Texas | Registered: October 24, 2006Report 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     General NUMBER Format

Copyright © 1996-2020 Information Builders