Decimal in String to Decimal Number Conversion

I think I'm out of luck after visting DejaNews (hints but no definitive
answer), but figured you all are worth a try... :)

My PB program imports a text file containing decimal numbers in the format
####.## (e.g., 1234.56), and then converts them to a number to put into a
numeric datawindow column.

Problem is that if regional settings are set to use the comma as decimal
separator and period as thousands separator, then the resulting number from
Real(ls_number) is 123456 rather than 1234.56. This is a big problem.

The only solution I have so far is to remove the decimal form the string,
convert, and then divide by 100 to get the right number back (may have to
make a smart function to figure out how many decimals and divide
accordingly).

Is there any better way to do this? Any way to force the conversion
functions to assume US format?

TIA,

Dan


0
Dan
9/20/2000 7:44:23 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

2 Replies
2062 Views

Similar Articles

[PageSpeed] 50

moin dan,
simply replace the '.' by ',' when the regional setting say so!
Real(Left(lsNumber, Pos('.') - 1) + ',' + Mid(lsNumber, Pos('.') + 1))
--
==========================
andatec gesellschaft f�r
angewandte datentechnik mbh
ruwoldtweg 15
D-22309 hamburg
---------------------------------------
Dipl.-Ing. G�nther Jungbluth
gjungbluth@andatec.de
==========================

"Dan Crough" <dcrough@nospam.solnow.com> schrieb im Newsbeitrag
news:h9vKy0zIAHA.202@forums.sybase.com...
> I think I'm out of luck after visting DejaNews (hints but no definitive
> answer), but figured you all are worth a try... :)
>
> My PB program imports a text file containing decimal numbers in the format
> ####.## (e.g., 1234.56), and then converts them to a number to put into a
> numeric datawindow column.
>
> Problem is that if regional settings are set to use the comma as decimal
> separator and period as thousands separator, then the resulting number
from
> Real(ls_number) is 123456 rather than 1234.56. This is a big problem.
>
> The only solution I have so far is to remove the decimal form the string,
> convert, and then divide by 100 to get the right number back (may have to
> make a smart function to figure out how many decimals and divide
> accordingly).
>
> Is there any better way to do this? Any way to force the conversion
> functions to assume US format?
>
> TIA,
>
> Dan
>
>


0
GJungbluth
9/21/2000 8:46:31 AM
Thanks. I'll look into where I can get the Regional Setting.

Dan

"GJungbluth" <GJungbluth@andatec.de> wrote in message
news:f6Ojfq6IAHA.70@forums.sybase.com...
> moin dan,
> simply replace the '.' by ',' when the regional setting say so!
> Real(Left(lsNumber, Pos('.') - 1) + ',' + Mid(lsNumber, Pos('.') + 1))
> --
> ==========================
> andatec gesellschaft f�r
> angewandte datentechnik mbh
> ruwoldtweg 15
> D-22309 hamburg
> ---------------------------------------
> Dipl.-Ing. G�nther Jungbluth
> gjungbluth@andatec.de
> ==========================
>
> "Dan Crough" <dcrough@nospam.solnow.com> schrieb im Newsbeitrag
> news:h9vKy0zIAHA.202@forums.sybase.com...
> > I think I'm out of luck after visting DejaNews (hints but no definitive
> > answer), but figured you all are worth a try... :)
> >
> > My PB program imports a text file containing decimal numbers in the
format
> > ####.## (e.g., 1234.56), and then converts them to a number to put into
a
> > numeric datawindow column.
> >
> > Problem is that if regional settings are set to use the comma as decimal
> > separator and period as thousands separator, then the resulting number
> from
> > Real(ls_number) is 123456 rather than 1234.56. This is a big problem.
> >
> > The only solution I have so far is to remove the decimal form the
string,
> > convert, and then divide by 100 to get the right number back (may have
to
> > make a smart function to figure out how many decimals and divide
> > accordingly).
> >
> > Is there any better way to do this? Any way to force the conversion
> > functions to assume US format?
> >
> > TIA,
> >
> > Dan
> >
> >
>
>


0
Dan
9/21/2000 6:03:59 PM
Reply:

Similar Artilces:

Decimal conversion error. Powerbuilder only supports 18 decimal digits
Hi, When connecting to my database and trying to get result from a table, I get this error. What does it mean ? Hi Dave; Newer version of PB support 28 digits for a decimal column. Can you tell us .... 1) PB version you are using 2) DBMS version that you are using. 3) Connectivity mechanism 4) Table column's datatype that you are trying to access. 5) DataWindow's column data type for the error. etc -- Regards ... Chris ISUG - NA RUG Director http://chrispollach.pbdjmagazine.com <Dave> wrote in message news:4acdda9f.79ff.1681692777@sybase.com... &g...

"Decimal Conversion Error: PowerBuilder supports only 18 decimal digits
Hi PB 10.5 brings me this error . WHY ? but comes in IDE and not in executable ... I do not understand what is happening .... Is it a migration issue .. My earlier source was in PB10.0 and there is no error . Where we have DisableUnicode=1 option ?? -- Regards Van Note: PB 10.5 supports 28 digit decimal numbers. Where do you get this error message - Oracle DBMS? "Van" <VanJacobson@hotmail.com> wrote in message news:456bf69a@forums-1-dub... > Hi > PB 10.5 brings me this error . WHY ? but comes in IDE and not in executable > .. I do not u...

Select error: Decimal conversion error. PowerBuilder only supports 18 decimal digits.
--------------BAF4191ECA9443C722ED4CAD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit With any table with a NUMBER column comes the following message: Select error: Decimal conversion error. PowerBuilder only supports 18 decimal digits. DB: IBM OS 390 with Oracle 8.0.4.3.1 PB: 7.0 Build DB Profile: SQLCA.DBMS = "O84 ORACLE 8.0.4" SQLCA.LogPass = <*******> SQLCA.ServerName = pppfs31 SQLCA.LogId = system SQLCA.AutoCommit = False SQLCA.DBParm = "" Please help ! Thanks. Rico Obrist --------------BAF4191EC...

Select error: Decimal conversion error. PowerBuilder only supports 18 decimal digits.
Hi, when I run a crosstabular report, I get the following error: Select error: Decimal conversion error. PowerBuilder only supports 18 decimal digits. I am not using any NUMBER columns that have more than 19 digits. I am however using the TIMESTAMP Oracle datatype. Sometimes, I don't get the error but PB crashes instead. I have PB 10.2.1 Build 9004. I also have over 350 datawindows in my project. Does that have anything to do with it? Thanks, Joelle >Sorry I meant more than 18 Hi, > when I run a crosstabular report, I get the following > error: Select err...

CLR.NET datatype for decimal is System.String or Decimal
CLR.NET datatype for decimal is System.String or System.Decimal the documentation says System.string while it is mapped to DbType.decimal I need some understanding on this. any help thanks vsv ...

inserting a decimal number from.net to stored proc. with decimal parameter
I'm trying to enter large number 99999999, (8 digits) converting to decimal in .NET, then using that as a parameter in stored proc. which has a decimal type (decimal(15,2) as a parameter. C#:if (txtAnnualizedSaving.Text.Trim() != string.Empty) {try { sdata.AnnualizedSaving = Convert.ToDecimal(txtAnnualizedSaving.Text); // only for testing ....scale = (System.Decimal.GetBits(sdata.AnnualizedSaving)[3] >> 16) & 31; }catch { sdata.AnnualizedSaving = 0; } }   ... In the business object I have the following code:private bool UpdateData() {bool ret = false; try ...

External datawindow with columns of type DECIMAL, number of decimals is not saved!!
Almost a year ago, I've posted this problem. It does not seem to be fix yet. When you create an external datawindow and you create a column of type decimal, you can fill in the number of decimals. That number is not saved. When I reopen the datawindow; the number of decimals is 0. The only workaround I've found is to go change it in the source code of the datawindow Greetings Note that posting a problem in one of the newsgroups will not fix it. Only if you open a case with Sybase it will be fixed. On 9 Nov 2004 01:39:15 -0800, in sybase.public.pocketpo...

Number Conversion
Questoin #1: Is there a function or module to convert numbers to/from decimal, binary, and hex? Question #2: Is there a function or module to perform binary calculations (AND, OR, XOR)? Russell J Foster e. russ.foster@swc.com Russ Foster wrote: > > Questoin #1: Is there a function or module to convert numbers to/from > decimal, binary, and hex? perldoc -f hex perldoc -f oct perldoc -f sprintf perldoc -f vec perldoc POSIX # Look for strtol() and strtoul() > Question #2: Is there a function or module to perform binary calculations > (AND, OR, XO...

Converting string to 2 digit decimal number
 Hi all,My question is how to convert a string like 80.00 to a number with 2 decimal digits. I've tried many solutions such as formating the string and then converting the string to double but it doesn't work, still shows as 80.0. Can anyone help me with that?Thanks   For display purposes you can use string.format. I'm assuming this is currency related variable.decimal moneyValue = 80.0m; string displayValue = String.Format("Total: {0:C}", moneyValue); Console.WriteLine(displayValue); Dev  What I meant was converting string to decimal not ...

Powerbuilder 11.5 decimal(0) number
In a crosstab we have set column weeknumber for the rows. The datawindow type of weeknumber is a number. Style type is edit. Value show in PB 10.2 = 200739. Value shown in PB 11.5 = 9,9178243680526E-319 Changing the datawindow type to decimal(0) shows the correct value 200739. Is this a bug or should we change this everywhere in our programm? Thanks Eric ...

Decimal and number
Hi I try to update Oracle datatypes (NUMBER 10,2) see the code below To do this I use Sybase type Decimal 10,2. Transaction return code : Invalid number... What can I do. Shall I change Oracle or Sybase datatype. UPDATE etwadm.cle_rep SET bud_conso = (bud_conso + :ldec_ConsoTot), bud_cout = (bud_cout + :ldec_CoutTot), bud_cout_euro = (bud_cout_euro + :ldec_CoutTotEuro) WHERE (an = :as_FacKey.An AND art_cod = :as_FacKey.ArtCod AND cpt_mat = :as_FacKey.CptMat AND cpt_no = :as_FacKey.CptNo) USING auo_Trans; Could you put the connection into trace mode and g...

Decimal numbers
------_=_NextPart_001_01C1E466.832483D0 Content-Type: text/plain; charset="iso-8859-1" Hi guys I was wondering if you could help me. If I read a value of 123.456 and I would like to print this value out as 123456 (without decimals), how can I go about it without doing any multiplication ? I would be most grateful for any advice. Thanks in advance Tony ------_=_NextPart_001_01C1E466.832483D0-- > Hi guys > I was wondering if you could help me. > If I read a value of 123.456 and I would like to print this value out as > 123456 (without decimals), how ...

String to decimal
This must have been asked a thousand times but I cannot find the answer. I have a string that I need as a decimal. It goes into a bunch of decimal place precision that caused rounding errors over the course of adding thousands of these numbers together. sting ls_number decimal ld_number ls_number = "42,508.26" ld_number = real( ls_number ) // ld_number is now 42508.2617185 How do I avoid this? Presuming this value is always 2 fixed decimal points, declare as decimal{2} ld_number Or use ld_number = Dec(ls_number) You're jumping between fixed...

Decimal , string ....
Dear all, I am reading a file with amounts , fixed format 0001321311145 4564646431231 1113123131311 i have to read the values (no problem) and then convert them to a decimal variable with 2 decimals behind the comma. so 13213111,45 45646464312,31 11131231313,11 I am not sure how to convert the string value (13 long) to a dec(11,2) TIA John Dec(stringvar)/100 -- Simon Caldwell Get Real Systems Ltd Holtby Manor, Stamford Bridge Road, York, YO19 5LL Tel +44 (0)1904 481999 Fax +44 (0)1904 481666 Visit us at www.getrealsystems.com Procurement Control S...

Web resources about - Decimal in String to Decimal Number Conversion - sybase.powerbuilder.general

Gene conversion - Wikipedia, the free encyclopedia
Gene conversion is the process by which one DNA sequence replaces a homologous sequence such that the sequences become identical after the conversion ...

Family of Enrique Marquez unaware of his 2014 marriage, conversion to Islam
The family members of Enrique Marquez, the man linked to the San Bernardino massacre, said they were unaware he was married or that he had converted ...

Effective Strategies for Increasing E-Commerce Conversions
... tips for improving your ecommerce strategy and related outcomes. Social signals are a powerful tool for engaging users and increasing conversion ...

Christmas Verse: A tale of conversion or, as Christians view it, re-birth
The Journey of the Magi, T. S. Eliot 'A cold coming we had of it, Just the worst time of the year For a journey, and such a long journey: The ...

Revisiting Carlos Martinez's rotation conversion
... thanks to his pitch mix, then it sure sounded like it could be possible. Now, almost a full year later, I wanted to revisit Martinez's conversion. ...

Dow to Force Conversion of Buffett Preferreds If Rally Holds
Bloomberg Dow to Force Conversion of Buffett Preferreds If Rally Holds Bloomberg Dow Chemical Co., which has been paying $255 million annually ...

​Judge orders N.J. "gay conversion" nonprofit to close
Jews Offering New Alternatives for Healing, known as JONAH, ordered to cease operations within 30 days

Malaysian mother loses court battle over conversion of children to Islam
A kindergarten teacher in Malaysia is to appeal to a higher court after she lost a case challenging the conversion of all her three children ...

Council votes to ban gay 'conversion' therapy in Cincinnati
Cincinnati follows four states and the District of Columbia banning the therapy, becoming the first city outside D.C. to do so.

Solar Frontier Pushes CIS (aka CIGS) Thin Film Solar Envelope With New Conversion Record, Factory Model ...
Japan's Solar Frontier comes up with a killer combo, a new low cost thin film solar manufacturing model and a new solar conversion efficiency ...

Resources last updated: 1/17/2016 11:02:44 AM