Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11455 > unrolled thread
| Started by | Martin <Martin@spam.spam> |
|---|---|
| First post | 2018-03-06 13:28 +0000 |
| Last post | 2018-03-06 23:56 -0800 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Bug in Val() Martin <Martin@spam.spam> - 2018-03-06 13:28 +0000
Re: Bug in Val() dlzc <dlzc1@cox.net> - 2018-03-06 06:05 -0800
Re: Bug in Val() Martin <Martin@spam.spam> - 2018-03-06 15:17 +0000
Re: Bug in Val() Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2018-03-06 15:15 +0100
Re: Bug in Val() Martin <Martin@spam.spam> - 2018-03-06 15:18 +0000
Re: Bug in Val() Mathias <mathias.hakansson@consultec.se> - 2018-03-06 23:56 -0800
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2018-03-06 13:28 +0000 |
| Subject | Bug in Val() |
| Message-ID | <p7m519$u20$1@dont-email.me> |
Working with a CSV and getting the data into our software "500,000.00" Val() returns 500 NOT 500000 Taken me ages, checking our CSV importer (as the VO one does the same truncation into a numeric field). So used my own into an array and parsing that. Just to find that Val() is broken Off to write my own now! aghhhhhhhh!!!!!!!!!!!!!!!!
[toc] | [next] | [standalone]
| From | dlzc <dlzc1@cox.net> |
|---|---|
| Date | 2018-03-06 06:05 -0800 |
| Message-ID | <2b3d825c-3127-4ca8-ad1b-383feb2a75c3@googlegroups.com> |
| In reply to | #11455 |
Dear Martin: On Tuesday, March 6, 2018 at 6:28:11 AM UTC-7, Martin wrote: > Working with a CSV and getting the data into our software > > "500,000.00" > > Val() returns 500 NOT 500000 What is set as your decimal separator, and thousands separator, when you do the conversion? cConvertNow := strtran( cStringWithCommas, "," ) David A. Smith
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2018-03-06 15:17 +0000 |
| Message-ID | <p7mbec$gdj$1@dont-email.me> |
| In reply to | #11456 |
Just use usual UK , for thousands and a decimal point On 06/03/2018 14:05, dlzc wrote: > Dear Martin: > > On Tuesday, March 6, 2018 at 6:28:11 AM UTC-7, Martin wrote: >> Working with a CSV and getting the data into our software >> >> "500,000.00" >> >> Val() returns 500 NOT 500000 > > What is set as your decimal separator, and thousands separator, when you do the conversion? > > cConvertNow := strtran( cStringWithCommas, "," ) > > David A. Smith >
[toc] | [prev] | [next] | [standalone]
| From | Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> |
|---|---|
| Date | 2018-03-06 15:15 +0100 |
| Message-ID | <i78t9d104nj1rh0mav57jupe9uovl42895@4ax.com> |
| In reply to | #11455 |
Martin, Help says: ...However, if <cNumber> is not entirely a valid numeric expression but does contain decimal numerics, Val() evaluates it until it reaches a second decimal point, the first non-numeric character, or the end of the expression... So, what do you expect? Garbage in, garbage out ;-) Karl >Working with a CSV and getting the data into our software > >"500,000.00" > >Val() returns 500 NOT 500000 > >Taken me ages, checking our CSV importer (as the VO one does the same >truncation into a numeric field). > >So used my own into an array and parsing that. > >Just to find that Val() is broken > >Off to write my own now! > > >aghhhhhhhh!!!!!!!!!!!!!!!! Regards Karl
[toc] | [prev] | [next] | [standalone]
| From | Martin <Martin@spam.spam> |
|---|---|
| Date | 2018-03-06 15:18 +0000 |
| Message-ID | <p7mbgb$gdj$2@dont-email.me> |
| In reply to | #11457 |
But you still would expect it to handle a thosand separator Oh well lesson learnt after over 30 years of XBase On 06/03/2018 14:15, Karl Faller wrote: > Martin, > Help says: ...However, if <cNumber> is not entirely a valid numeric > expression but does contain decimal numerics, Val() evaluates it until > it reaches a second decimal point, the first non-numeric character, or > the end of the expression... > > So, what do you expect? > Garbage in, garbage out ;-) > > Karl > >> Working with a CSV and getting the data into our software >> >> "500,000.00" >> >> Val() returns 500 NOT 500000 >> >> Taken me ages, checking our CSV importer (as the VO one does the same >> truncation into a numeric field). >> >> So used my own into an array and parsing that. >> >> Just to find that Val() is broken >> >> Off to write my own now! >> >> >> aghhhhhhhh!!!!!!!!!!!!!!!! > Regards > > Karl >
[toc] | [prev] | [next] | [standalone]
| From | Mathias <mathias.hakansson@consultec.se> |
|---|---|
| Date | 2018-03-06 23:56 -0800 |
| Message-ID | <ade42794-48de-4c69-ac0e-be1470d44f10@googlegroups.com> |
| In reply to | #11455 |
Den tisdag 6 mars 2018 kl. 14:28:11 UTC+1 skrev Martin:
> Working with a CSV and getting the data into our software
>
> "500,000.00"
>
> Val() returns 500 NOT 500000
>
> Taken me ages, checking our CSV importer (as the VO one does the same
> truncation into a numeric field).
>
> So used my own into an array and parsing that.
>
> Just to find that Val() is broken
>
> Off to write my own now!
>
>
> aghhhhhhhh!!!!!!!!!!!!!!!!
It's the same in sweden. Thousand separator is " " (space), but Val("500 000,00" is 500. You will need to trim the thousand separator first. I often read texfiles where the numbers don't have decimal separators at all, but when reading prices the two last characters are decimals. In that case I divide by Pow(10, noOfDecimals).
/Mathias
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web