Hi all,
Hoping you can shed some light for me. I've got a calculation that I'm
doing over 4 fields and then I convert the result to character by applying
STR() function - doing this to a length of 20 and decimal places of 2. This
rounds UP my result. I don't want this to happen. Just want it to give me
the result to 2 decimal places.
Is this possible in Fox?
TIA,
Tina
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/003501caebd5$2e292410$8a7b6c30$@com.au
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
You could always multiply by 100, apply the integer function, then divide
by 100.
Richard E. Quilhot C.N.A.
quilhotr@gmail.com
On Tue, May 4, 2010 at 6:00 PM, Tina Currie <tina@datahouse.com.au> wrote:
> Hi all,
>
>
>
> Hoping you can shed some light for me. I've got a calculation that I'm
> doing over 4 fields and then I convert the result to character by applying
> STR() function - doing this to a length of 20 and decimal places of 2.
> This
> rounds UP my result. I don't want this to happen. Just want it to give me
> the result to 2 decimal places.
>
>
>
> Is this possible in Fox?
>
>
>
> TIA,
>
>
>
> Tina
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/j2zbfe30b7d1005041513p96ecec11k2ed039deb114780c@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
You can try this. SET DECIMALS TO 1 more than you're formatting, in your
case 3. Then use TRANSFORM(your number,"99999999999999999.99") to get it as
a string. As long as the SET DECIMAL is at least 1 more than you're
formatting to, it will truncate, not round.
Fred
On Tue, May 4, 2010 at 3:00 PM, Tina Currie <tina@datahouse.com.au> wrote:
> Hi all,
>
>
>
> Hoping you can shed some light for me. I've got a calculation that I'm
> doing over 4 fields and then I convert the result to character by applying
> STR() function - doing this to a length of 20 and decimal places of 2.
> This
> rounds UP my result. I don't want this to happen. Just want it to give me
> the result to 2 decimal places.
>
>
>
> Is this possible in Fox?
>
>
>
> TIA,
>
>
>
> Tina
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/s2g3392e7101005041514i142c785jc402b68c44eae2cd@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
> -----Original Message-----
> From: profoxtech-bounces@leafe.com
[mailto:profoxtech-bounces@leafe.com]
> On Behalf Of Tina Currie
> Sent: Tuesday, May 04, 2010 3:00 PM
> To: profoxtech@leafe.com
> Subject: VFP Rounding
>
> Hi all,
>
>
>
> Hoping you can shed some light for me. I've got a calculation that
I'm
> doing over 4 fields and then I convert the result to character by
applying
> STR() function - doing this to a length of 20 and decimal places of 2.
> This
> rounds UP my result. I don't want this to happen. Just want it to
give
> me
> the result to 2 decimal places.
>
Have you tried using ROUND(), then convert using STR() ?
Thanks,
Matthew Jarvis || Business Systems Analyst
IT Department
McKenzie-Willamette Medical Center
1460 G Street, Springfield, OR 97477 || Ph: 541-744-6092 || Fax:
541-744-6145
--------------------------------------------------------------------------
Disclaimer: This electronic message may contain information that is
Proprietary, Confidential, or legally privileged or protected. It
is intended only for the use of the individual(s) and entity named
in the message. If you are not an intended recipient of this
message, please notify the sender immediately and delete the
material from your computer. Do not deliver, distribute or copy
this message and do not disclose its contents or take any action in
reliance on the information it contains.
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/69F310C05DD83C48A84BA3769CE1ECF803279A81@TNTRIEXEVS02.triadhospitals.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Use TRANSFORM with a picture clause if you're not interested in the extra precision. Otherwise use ROUND.
m.v1=100.1234
m.v2=100.1234
m.v3=100.1234
m.v4=100.1234
m.nresult=m.v1+m.v2+m.v3+m.v4
m.cresult=transform(m.nresult, '@R 999,999,999.99')
WAIT WINDOW m.nresult
WAIT WINDOW m.cresult
rk
-----Original Message-----
From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On Behalf Of Tina Currie
Sent: Tuesday, May 04, 2010 6:00 PM
To: profoxtech@leafe.com
Subject: VFP Rounding
Hi all,
Hoping you can shed some light for me. I've got a calculation that I'm
doing over 4 fields and then I convert the result to character by applying
STR() function - doing this to a length of 20 and decimal places of 2. This
rounds UP my result. I don't want this to happen. Just want it to give me
the result to 2 decimal places.
Is this possible in Fox?
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD0440682815CE6@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
And as someone else mentioned you do need to set decimals to some number greater than the precision you want to preserve if you don't want the transform to do an implicit round. The PADx functions also do an implicit transform if you want a fixed string length but then you will get full precision.
rk
-----Original Message-----
From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye
Sent: Tuesday, May 04, 2010 6:15 PM
To: profoxtech@leafe.com
Subject: RE: VFP Rounding
Use TRANSFORM with a picture clause if you're not interested in the extra precision. Otherwise use ROUND.
m.v1=100.1234
m.v2=100.1234
m.v3=100.1234
m.v4=100.1234
m.nresult=m.v1+m.v2+m.v3+m.v4
m.cresult=transform(m.nresult, '@R 999,999,999.99')
WAIT WINDOW m.nresult
WAIT WINDOW m.cresult
rk
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD0440682815CEB@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
What about floor()
----- Original Message -----
From: "Richard Kaye" <RKaye@artfact.com>
To: <profox@leafe.com>
Sent: Tuesday, May 04, 2010 3:32 PM
Subject: RE: VFP Rounding
And as someone else mentioned you do need to set decimals to some number greater than the precision you want to preserve
if you don't want the transform to do an implicit round. The PADx functions also do an implicit transform if you want a
fixed string length but then you will get full precision.
rk
-----Original Message-----
From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye
Sent: Tuesday, May 04, 2010 6:15 PM
To: profoxtech@leafe.com
Subject: RE: VFP Rounding
Use TRANSFORM with a picture clause if you're not interested in the extra precision. Otherwise use ROUND.
m.v1=100.1234
m.v2=100.1234
m.v3=100.1234
m.v4=100.1234
m.nresult=m.v1+m.v2+m.v3+m.v4
m.cresult=transform(m.nresult, '@R 999,999,999.99')
WAIT WINDOW m.nresult
WAIT WINDOW m.cresult
rk
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/014101caebdc$15d36b30$7a00a8c0@w2k3s02
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Thanks Richard,
That did the trick :-)
Glad I just asked rather than screwing around with that for too long!
Tina
-----Original Message-----
From: Richard Quilhot [mailto:quilhotr@gmail.com]
Sent: Wednesday, 5 May 2010 8:14 AM
To: ProFox Email List
Subject: Re: VFP Rounding
You could always multiply by 100, apply the integer function, then divide
by 100.
Richard E. Quilhot C.N.A.
quilhotr@gmail.com
On Tue, May 4, 2010 at 6:00 PM, Tina Currie <tina@datahouse.com.au> wrote:
> Hi all,
>
>
>
> Hoping you can shed some light for me. I've got a calculation that I'm
> doing over 4 fields and then I convert the result to character by applying
> STR() function - doing this to a length of 20 and decimal places of 2.
> This
> rounds UP my result. I don't want this to happen. Just want it to give
me
> the result to 2 decimal places.
>
>
>
> Is this possible in Fox?
>
>
>
> TIA,
>
>
>
> Tina
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/005e01caebe3$f73a3110$e5ae9330$@com.au
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.