How to remove decimal from data ? 
Author Message
 How to remove decimal from data ?
I just imported some data from excel but now price in my data file is 7.07.
How can I get rid of decimal.  I just want to have 707.

Thanks



Sat, 02 Jul 2005 04:06:58 GMT
 How to remove decimal from data ?

001    OPEN 'FILE' TO F.FILE ELSE STOP
002    SELECT F.FILE
003    ATTR = ? <----- Set this to the attribute number containing the
decimal.
004    DONE = 0
005    LOOP
006      READNEXT ID ELSE DONE = 1
007    UNTIL DONE DO
008      READ ITEM FROM F.FILE,ID THEN
009         ITEM<ATTR> = OCONV(ITEM<ATTR>,'MCN') ; * returns only numerics
010         WRITE ITEM ON F.FILE,ID
011      END
012    REPEAT

Alternatively, if you have just one attribute to fix, you could change lines
008-010 thusly:

008      READV LINE FROM F.FILE,ID,ATTR THEN
009         LINE = OCONV(LINE,'MCN') ; * returns only numerics
010         WRITEV LINE ON F.FILE,ID,ATTR

Ed

Quote:

> I just imported some data from excel but now price in my data file is
> 7.07. How can I get rid of decimal.  I just want to have 707.

> Thanks



Sat, 02 Jul 2005 04:33:04 GMT
 How to remove decimal from data ?
Do a prestore command or write a program


Sat, 02 Jul 2005 04:36:08 GMT
 How to remove decimal from data ?


Quote:
> I just imported some data from excel but now price in my data file is
> 7.07. How can I get rid of decimal.  I just want to have 707.

> Thanks

DATA * 100 would work in a basic program.  If you had a small number of
items you could do it in a pre-store command in the editor.

Each flavor has its own way of doing macros or pre-stores, but you would
replace the '.' with ''.

--
kevin zollinger



Sat, 02 Jul 2005 04:41:31 GMT
 How to remove decimal from data ?

Quote:
> I just imported some data from excel but now price in my data file is 7.07.
> How can I get rid of decimal.  I just want to have 707.

It depends.  If all data is in the form 99.99 then you can do as others have
suggested, such as editing the file and doing a replace with a prestore
command, or using a Basic program and Oconv(value,'MCN').

However, as I have seen in some Excel imports, you have imported "5" for an
Excel value that was 5.00, then you should use a basic program to multiply all
values by 100 or use ICONV (value,'MR2').

K. Powick



Sat, 02 Jul 2005 06:19:49 GMT
 How to remove decimal from data ?
Decide ehat your implied decimal positon is (2 in this case) and do the
following:

newValue = ICONV(value,'MR2')

if Value is 7.07 then the newValue is 707.  If value is 8, then new value is
800, etc.

Harv


Quote:
> I just imported some data from excel but now price in my data file is
7.07.
> How can I get rid of decimal.  I just want to have 707.

> Thanks



Sat, 02 Jul 2005 06:53:12 GMT
 How to remove decimal from data ?

Quote:

>I just imported some data from excel but now price in my data file is 7.07.
>How can I get rid of decimal.  I just want to have 707.

>Thanks

Before importting the excel file it is important to set the format of
the numeric cells.  Make sure you have it set to a numeric format with
the number of decimal places predetermined.  You will get inconsistant
results if the numbers are sporatically formatted.

-Adam



Sat, 02 Jul 2005 07:19:35 GMT
 How to remove decimal from data ?
Quote:

> I just imported some data from excel but now price in my data file is 7.07.
> How can I get rid of decimal.  I just want to have 707.

> Thanks

************************************************
try this!

bad data = '7.07.'
good.data = field(bad.data,'.',2)

then do whatever you need with the good.data



Sat, 02 Jul 2005 20:49:44 GMT
 How to remove decimal from data ?
You want to INPUT convert the decimal number - In this case with 2 implied
decimals

inNum = ICONV(decNum,'MR2')

7.07 becomes 707


Quote:
> I just imported some data from excel but now price in my data file is
7.07.
> How can I get rid of decimal.  I just want to have 707.

> Thanks



Sat, 02 Jul 2005 20:48:17 GMT
 How to remove decimal from data ?

Quote:



>> I just imported some data from excel but now price in my data file
>> is 7.07. How can I get rid of decimal.  I just want to have 707.

>> Thanks
> ************************************************
> try this!

> bad data = '7.07.'
> good.data = field(bad.data,'.',2)

> then do whatever you need with the good.data

You'll need to get the other half of the bad data.

Ed



Sat, 02 Jul 2005 23:30:16 GMT
 How to remove decimal from data ?
Why not:

good.data = oconv(bad.data,'mcn')

if there are always 2 places of decimals, or

good.data = int(bad.data *100)



Sat, 02 Jul 2005 23:48:00 GMT
 How to remove decimal from data ?

Quote:

> I just imported some data from excel but now price in my data file is
> 7.07.
> How can I get rid of decimal.  I just want to have 707.

> Thanks

How about:

AMOUNT=7.07
CONVERT '.' TO '' IN AMOUNT

--
Bob Little
Graphik Dimensions, Ltd
High Point, NC



Tue, 05 Jul 2005 22:58:33 GMT
 
 [ 12 post ] 

 Relevant Pages 

1. SQLCODE -310 DECIMAL HOST VARIABLE CONTAINS NON-DECIMAL DATA

2. Is there any way of removing all the trailing zeros after the decimal

3. removing decimal point

4. Removing leading zeros after decimal point

5. Can a .00 be removed in an SQL Statement from a Decimal field

6. Removing the decimal in an amount field

7. Removing Hyphens & Decimals

8. Remove decimal places

9. Removing decimal points when printing - Thanks

10. Removing Decimal Points in Reports

11. Removing decimal points when printing

12. Removing Decimal points in Reports


 
Powered by phpBB® Forum Software