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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Double to integer
 Login/Join
 
Gold member
posted
Hi all,

I have the following problem...
I have a filed that contains a double values (eg. 1234.55)

I want to print only 1234.

How I can convert/format the field?


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
Use the INT function.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
You can also just equate it to another field defined as integer or a double with no scale. It will truncate anything after the decimal point.

FLDINT/I4=DBLFLD;


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
Thanks

...and how I can format it like this "1,234" Confused


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
Do you want to convert it to integer or just print it with a comma and no decimals?

Ginny gave the integer coversion.

I know you are new to the game, but look up the formatting of output on reports.

You can try,
  PRINT FIELD/D6 

the /D6

gives only the whole and no decimals, assuming the field is defined in the master with decimals


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Gold member
posted Hide Post
Sorry,

here is my case:

I have a field with decimal values and I want to convert it into a alphabetic field that is formated with comma and no decimals...


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
INT1/A8 = FTOA(decfld,'(D6)','A8');


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
Thank you very much Alan B


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Expert
posted Hide Post
OK, that is clearer.
DEFINE FILE CAR
DBLFLD/D7.2=1234.55;
-* If FLD_NODEC is a D format, rounding will occur.  With an I format, there is no rounding.  Your choice.
FLD_NODEC/I4=DBLFLD;
FLD_ALPHA/A10=FTOA(FLD_NODEC,'(D4)', 'A10');
END
TABLE FILE CAR
PRINT DBLFLD FLD_NODEC FLD_ALPHA
BY COUNTRY
END  


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
and another question:

I used the example of the Alan B and it works perfect but the alignment of the field is left.

how I can set it to right?


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
I know this may sound like a broken record, but how are you using this field?


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
L_G

Alpha are left justified, numeric right. You asked for alpha.

If you want it alpha AND right justified use the style sheet.

As Leah says, how are you using this field?


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
The output of the report is a text file (it is requirement) Frowner

Here is the file otput:

  
*************************
 I          I          I 
 I    GEN   I    FEB   I 
 I          I          I 
=I==========I==========I=
 I  2,153   I          I 
 I  1,525   I          I 
 I          I          I 
 I 13,653   I 14,218   I 



I want to justified like this:

  
*************************
 I          I          I 
 I    GEN   I    FEB   I 
 I          I          I 
=I==========I==========I=
 I    2,153 I          I 
 I    1,525 I          I 
 I          I          I 
 I   13,653 I   14,218 I 



WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
if only the output is a text file you can just say

PRINT FIELD/D6 


no conversion is needed.
maybe some basic training....! Music




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Gold member
posted Hide Post
yes but I create one alphanumeric field that is combination other field , for example:

DEFINE FILE somefile
MYFIELD/A100 = '*'|field1|'*';
END

field1 is FTOA(decfld,'(D6)','A8');

The file output is only MYFIELD


WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
 
Posts: 72 | Registered: January 14, 2008Report This Post
Expert
posted Hide Post
Run RJUST function on it after you do the concatenation.

You might want to peruse the functions manual.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Guru
posted Hide Post
After you become familiar with the available functions, you might want to create some of your own functions.

Here's one I created right after I discovered that I could create my own. It's a little crude. But if it isn't broke, don't fix it.

DEFINE FUNCTION TRUNC(NUMBER/D12.2)
NUMBER_100/D12 = NUMBER*100;
NUMBER_100_FTOA/A18 = FTOA(NUMBER_100, '(D12)', 'A18');
NUMBER_100_FTOA_NOCOMMA/A18 = STRIP(18, NUMBER_100_FTOA, ',', 'A18');
NUMBER_100_FTOA_NOSPACE/A18 = STRIP(18, NUMBER_100_FTOA_NOCOMMA, ' ', 'A18');
NUMBER_100_FTOA_ARGLEN/I9 = ARGLEN(18, NUMBER_100_FTOA_NOSPACE, 'I9');
NUMBER_100_FTOA_SUBSTR/A18 = SUBSTR(18, NUMBER_100_FTOA_NOSPACE, 1,
                                    NUMBER_100_FTOA_ARGLEN - 2, NUMBER_100_FTOA_ARGLEN - 2, 'A18');
TRUNC/D12 = EDIT(NUMBER_100_FTOA_SUBSTR);
END


I know there are easier ways to get to what you wanted in this instance, but the funttion above will work when you truly need to truncate a number. Simply save the function and use it like an include.

Good Luck


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders