Topic Options
#18140 - 02/13/05 09:18 PM Using a spy with currency
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Hello OL,

I think I might have found a bug when trying to utilize a spy with a currency variable.

Here is the code that I used:

Code:
 &width := 0.0
&height := 0.0
margin(0,0.1667)
define(&z_,integer,0)
define(&X__,integer,0)
define(&a_,currency,0)
define(&b_,currency,0)
define(&c_,currency,0)
define(&d,string,'')
for(&z_,1,1,66)
        if((gt(pos('----CHARGES----',@(&z_,1,2000)),0)) and (@(&z_,1,1)<>'|'))
           for(&z_,&z_+1,1,66)
             if('CR' = @(&z_,60,61))
             &a_ := strtocur(trim(@(&z_,47,59))) %Will not show result, only shows 'Undeclared identifier: '&a_''
             &d := curtostr(&a_) %Had to convert the currency to a string to see result
             &b_ := &a_
             &X__ := &z_
             if(&X__ < &z_)
             %&c_ :=
             endif
             %if(or(gt(pos('------AID DESCRIPTION------',@(&z_,1,2000)),0),gt(pos('---DATE---',@(&z_,1,2000)),0)))
                %Exit()
             %endif()
                if(stringwidth(@(&current.line,47,59)) > &Width)
                  &Width := stringwidth(@(&current.line,47,59))
                endif()
               showright(trim(@(&z_,47,59)))
             endif()
             crlf(0.1667)
             &height := &height + 0.1667
           endfor()
        endif()
endfor() 
Please let me know if I'm doing anything wrong with trying to see the result.

Thanks in advance.
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#18141 - 02/13/05 09:44 PM Re: Using a spy with currency
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Hello OL,

To go along with this same point, whenever I have a dollar amount, in the datastream, of over a thousand (1,000.00), this number shows up as zero in my variable. It's ok if the number is under a thousand. It shows up properly in the variable, i.e. 50.50. Is there an issue with numbers that have a comma separating the thousands of dollars?

Thanks in advance.
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#18142 - 02/15/05 07:10 PM Re: Using a spy with currency
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Hello OL,

Just wanted to see if anyone had any suggestions on this.

Thanks,
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#18143 - 02/17/05 03:30 PM Re: Using a spy with currency
Anonymous
Unregistered


Hi Ken,

I've been testing your code for concerning the currency spy within PP. I seem to be generating the same result "Undeclared identifier: '&a_'". I keep you posted on any work arounds. As for the " 1,000.00" amount you have to use a string data type to handle this issue. Currency datatype is a specific type of measure. The minimum value is -99999999999999.9999 and a maximum value of +99999999999999.9999. Refer to your PPTAlk manuel for more information.

Top
#18144 - 02/17/05 11:05 PM Re: Using a spy with currency
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Vincent,

Thanks for your reply.

Per your description of the currency data type, "As for the " 1,000.00" amount you have to use a string data type to handle this issue. Currency datatype is a specific type of measure. The minimum value is -99999999999999.9999 and a maximum value of +99999999999999.9999. Refer to your PPTAlk manuel for more information.", I referred to the Talk manual again, but there isn't anything specific that says that commas cannot be used.
Normally, when I think of money or when writing it out, I usually use a comma to separate the thousands. In this particular datastream that I have, the dollar amounts are written out in this same fashion and what I'm trying to do within my Talk macro, even though I didn't get that far yet, was to add up a column of dollar amounts, but cannot do that with any numeric data types since the commas exist. Since the description of currency didn't specify about the commas, I had assumed that they would only be specific to a currency data type.

Please clarify the currency data types description.

Thanks in advance.
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#18145 - 02/18/05 12:54 PM Re: Using a spy with currency
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1929
Loc: Objectif Lune, Montreal, Qc
Hi Ken,

Maybe I can help clarify things a bit here.
The currency data type cannot recognize commas as part of a valid currency value. The reason being that those punctuation marks are Windows-specific. If you go into your regional options, you'll see you can change those (just like the date format, for instance). Therefore, commas, in some parts of the world, are used as thousands-separators, but in other parts of the world, they are used as the decimal separator.

PostScript printers cannot make that distinction and expect numeric values in a certain format. To make sure it can account for all possibilities, PlanetPress Talk must therefore use a standardized format, in which commas are not allowed and the dot is the decimal separator. This is a an issue with just about any programming language, not just PlanetPress Talk.

If it wasn't done this way, then your document might work on your machine, but not on someone else's, whose regional options might be different.

You should simply use the Strip() function to remove any unwanted characters (the commas, in your case) from the string, before converting it into a currency.
For instance:
Code:
&a_ := strtocur(strip(',',trim(@(&z_,47,59)))) 
I hope this helps.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#18146 - 02/18/05 08:58 PM Re: Using a spy with currency
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Philippe,

Thanks for your response. Your explanation clears up a lot. It never really dawned on me that commas weren't used as a separator in other parts of the world. I will give your suggestion and try and give you a further update when I have time to test. I'll see if this may cure the spy for currency, as well.

Thanks again.
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top