Normal Topic [Solved] Money/Numbers/Commas (Read 1304 times)
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
[Solved] Money/Numbers/Commas
Dec 4th, 2007 at 9:39pm
Print Post Print Post  
Trying what appears to be a simple thing...
Need to strip off the decimal and traling zeroes from money fields
Trying to use @del but can't seem to figure the process out..
Can someone point me in the right direction...

Again...thanks...

I mean it...really...Thanks...
« Last Edit: Dec 11th, 2007 at 8:54pm by Hammer »  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Money/Numbers/Commas
Reply #1 - Dec 4th, 2007 at 9:55pm
Print Post Print Post  
WriteLn(@Str(@Int(MoneyField)))
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
Re: Money/Numbers/Commas
Reply #2 - Dec 6th, 2007 at 2:02pm
Print Post Print Post  
Thank you Hammer...I am hoping that I will eventually get this with all y'alls help...

Very much appreciated...

Cliff
  
Back to top
 
IP Logged
 
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
Decimal point and trailing zeroes defy removal
Reply #3 - Dec 6th, 2007 at 6:01pm
Print Post Print Post  
I am trying to do what I imagine is a very very simple thing to most...
I need to remove the decimal and trailing zeroes from money fields while allowing the money element to remain as money...
I have tried playing with numerous iterations of the following and can delete stuff to the left of the decimal and to the right of the dollar sign with no problem (figuratively at this point of course) but...
I really need to be rid of the decimal and trailing zeroes...
When I use WriteLn I can "echo" the fact that I have "n" characters and this "n" value always corresponds to the the dollar amounts sans decimal point and zeroes...
My "code" in its current useless iteration follows...

Var vbucks as double
var buckslength as int

vbucks = sr_max_lim
buckslength = @Len(vbucks)

sr_max_lim = @left(@str(vbucks),2)

As always...any and all help is very much appreciated...

Thank you ...

Cliff
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: [Solved] Money/Numbers/Commas
Reply #4 - Dec 6th, 2007 at 8:48pm
Print Post Print Post  
Cliff,

I spliced this in as I don't think we need a second thread for the same thing.

Your most recent code is going to give you the leftmost two characters of whatever is in sr_max_lim when you start. If sr_max_lim is bound to a money field, it does not matter what you strip off. When you put the value back into the element, it will be reformatted with whatever number of decimal places it has been told to show.

Is the solution I gave you above not working? What exactly are you trying to do with this decimal place-less value?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
Re: [Solved] Money/Numbers/Commas
Reply #5 - Dec 6th, 2007 at 10:00pm
Print Post Print Post  
Sorry about cluttering up the forum with a similar post...wasn't quite sure how to "reopen" a solved issue...

The fix you previously gave me creates a pop up that shows the number of characters left of the decimal, in other words I'd see the number "4" pop up for example if $1,234.00 were in the sr_max_lim field.

The fix seems to point in the right direction (echoing the digits to the left of the decimal) so I tried working with that code to see if I could accomplish the stuff I describe below but...alas...I have thumbs for code..(or something like that)...

We are developing a database for the issuance of insurance policies automating an existing manual process with Sesame.
Part of what we want the database to do is produce what are known as declaration pages. These "dec-pages" define policy parameters for insurance agents and include policy premium information.

Historically, the manual process did not include the "cents" portion of money values as all dollars are rounded off to the nearest hundred. In keeping with precedence we want to do the same thing with Sesame.

That said, what I am trying to do is modify the money elements in this database so we see only $1,234 in the database with the intent that the same will then print into our merge docs (we are using WordMergeLite).

I can do this easily enough by changing the fields to numbers but...the caveat there is that we lose the commas...and, of course...we must have commas...!

Interesting world this IT biz...

I do very much appreciate your help...
Thank you kindly...
Cliff
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Money/Numbers/Commas
Reply #6 - Dec 6th, 2007 at 10:18pm
Print Post Print Post  
Cliff,

1. What is the Bound To Type of sr_max_lim?

2. You will not lose the commas if you change this to a number. You can format both Number and Money elements to display values with commas. You can format both to have commas as they are passed to WordMergeLite. You can tell Word itself to display the numbers with commas. There are lots of options here.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
Re: Money/Numbers/Commas
Reply #7 - Dec 11th, 2007 at 5:26pm
Print Post Print Post  
Hi Hammer...I am here two days a week only so have not responded sooner.
I've changed all the "money" fields to "number" fields, however...no commas...when posting to WMLite...
  
Back to top
 
IP Logged
 
Cliff
Full Member
***
Offline



Posts: 126
Location: New Hampshire
Joined: May 5th, 2006
Re: Money/Numbers/Commas
Reply #8 - Dec 11th, 2007 at 5:42pm
Print Post Print Post  
Ayup...just like the old farmer sez..."sometimes I can't see the forest for the trees"...
I modified the WMLite script to show commas for numbers and voila...!
In other words...Duh...
Thanks again...
Cliff
  
Back to top
 
IP Logged