View previous topic :: View next topic
|
Author |
Message |
jamshirqureshi
New User
Joined: 13 Aug 2006 Posts: 20 Location: mumbai
|
|
|
|
Hi All,
If anybodys know to convert any field into fraction in eazytrieve.
Suppose I am a reading a file and I have a value like price and before writing to the output file. I want to convert this price value into fraction.
If anybody knows how to convert or sample code please let me know
Thanks,
jamz |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Could you expand on the scope of fractions you are looking for?
Is .33 >> 1/3 or 33/100?
Is .25 >> 1/4 or 25/100? |
|
Back to top |
|
|
jamshirqureshi
New User
Joined: 13 Aug 2006 Posts: 20 Location: mumbai
|
|
|
|
I am looking for .33 these kind of fraction.
how to declare this in eazytrive and how to convert this?
suppose i have price value in 1 and i want to convert as .125 then i have to write to the output.
Thanks,
Jamz |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
That is decimal not fraction.
How are the fields defined?
If the field is defined as "FIELD1 5 N 2" and it contains 12345 it will be reported as 123.45 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
suppose i have price value in 1 and i want to convert as .125 then i have to write to the output. |
What calculation will you use to cause the result of .125?
Using only the price, i know of no way to convert it to some % or some decimal value.
If ytou post examples of a few values and the result you want from using those values, we should be able to offer better suggestions. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
dick scherrer wrote: |
Hello,
Quote: |
suppose i have price value in 1 and i want to convert as .125 then i have to write to the output. |
What calculation will you use to cause the result of .125?
Using only the price, i know of no way to convert it to some % or some decimal value.
If ytou post examples of a few values and the result you want from using those values, we should be able to offer better suggestions. |
He is trying to convert decimal to a fraction. .125 = 1/8
This would be simple if .125 = 125/1000 was acceptable but reducing a fraction would be more difficult. If 3 decimal places is most then it could be done with a table. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
jamshirqureshi wrote: |
I am looking for .33 these kind of fraction.
how to declare this in eazytrive and how to convert this? |
As he said.
Douglas Wilder wrote: |
If the field is defined as "FIELD1 5 N 2" and it contains 12345 it will be reported as 123.45 |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Well,
So far i've seen multiple thoughts that make sense to me. They are not "the same" but any could be the answer jamz is looking for.
For my $.02, i'd still like to see some sample "input" and what the desired "output" would be. . . |
|
Back to top |
|
|
|