Groups > dBase > dBase bug reports > Re: Translate Error




Translate Error

Translate Error
Sun, 06 Apr 2008 17:11:58 -040
dBASE PLUS 2.61.3 Win XP Pro

This may just be a misleading error message and I _NOW_ have a check
to prevent it but ....

copy the form below to translateError.wfm and run from navigator

Pressing Save performs the calculation show on the form and puts the
result < 0 > in the entryfield
Then it trys to calculate and save the result to a rowset
This gives a "translate error - value out of bounds" 
I would have expected a truncation to 0 at worst

Thanks

Frank

--------------------------------------------------------------------------------
--
/* use this to create tables for turnkey */
///////////////     test.wfm     ////////////////
close databases
close all
clear all
release all
clear memory
clear program
set proc to
//

if file('test.dbf')
   drop table 'test.dbf'
endif
create table 'test.dbf' ( ;
            field1 numeric (5,2), ;
            field2 char (10)  ;
            )



//
** END HEADER -- do not remove this line
//
// Generated on 04/06/2008
//
parameter bModal
local f
f = new translateErrorForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class translateErrorForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 16.0
      width = 63.2857
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      height = 1.0
      left = 15.0
      top = 3.5
      width = 21.0
      value = 0.0
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 18.0
      top = 6.5
      width = 15.2857
      text = "Save"
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 1.0
      left = 2.0
      top = 1.0
      width = 55.0
      fontBold = true
      text = "( 341.61 - 341.60 ) / 341.61 * 100"
   endwith


   function PUSHBUTTON1_onClick
      form.entryfield1.value :=  (341.61 - 341.60) / 341.61 * 100
      form.q.rowset.beginAppend()
      form.q.rowset.fields['field1'].value := (341.61 - 341.60) /
341.61 * 100
      form.q.rowset.save()
      return

   function form_onOpen
      this.q = new query()
      this.q.sql := 'select * from test'
      this.q.active := true
      return

endclass
Post Reply
Re: Translate Error
Wed, 9 Apr 2008 14:25:36 -0400
Hi Frank,

> dBASE PLUS 2.61.3 Win XP Pro
>
> This may just be a misleading error message and I _NOW_ have a check
> to prevent it but ....
>
> copy the form below to translateError.wfm and run from navigator
>
> Pressing Save performs the calculation show on the form and puts the
> result < 0 > in the entryfield
> Then it trys to calculate and save the result to a rowset
> This gives a "translate error - value out of bounds"
> I would have expected a truncation to 0 at worst

This is a BDE error and it was occurring as far back as Visual dBASE 7.5 and 
probably to 7.01.

A simple way to see the error is to

USE test.dbf
replace field1 with 0.001

The error occurs because the value is smaller than the field is capable of 
storing.
I suspect the BDE considers this an error because the digit it needs to 
truncate
is the most significant digit of the value.  If it was the least significant 
I think it would
just truncate it without any complaint, as the following shows:

If you try,
   replace field1 with 1.001

there is no error and the trailing decimals are truncated to fit.

- Marty -

Martin Kay
dataBased Intelligence, Inc.














Post Reply
Re: Translate Error
Wed, 09 Apr 2008 15:09:11 -040
Marty

Okay, I can work around it

Thanks for the confirmation

Frank Polan

On Wed, 9 Apr 2008 14:25:36 -0400, "Marty Kay"
<mkay@databi.com>
wrote:

>Hi Frank,
>
>> dBASE PLUS 2.61.3 Win XP Pro
>>
>> This may just be a misleading error message and I _NOW_ have a check
>> to prevent it but ....
>>
>> copy the form below to translateError.wfm and run from navigator
>>
>> Pressing Save performs the calculation show on the form and puts the
>> result < 0 > in the entryfield
>> Then it trys to calculate and save the result to a rowset
>> This gives a "translate error - value out of bounds"
>> I would have expected a truncation to 0 at worst
>
>This is a BDE error and it was occurring as far back as Visual dBASE 7.5 and

>probably to 7.01.
>
>A simple way to see the error is to
>
>USE test.dbf
>replace field1 with 0.001
>
>The error occurs because the value is smaller than the field is capable of 
>storing.
>I suspect the BDE considers this an error because the digit it needs to 
>truncate
>is the most significant digit of the value.  If it was the least significant

>I think it would
>just truncate it without any complaint, as the following shows:
>
>If you try,
>   replace field1 with 1.001
>
>there is no error and the trailing decimals are truncated to fit.
>
>- Marty -
>
>Martin Kay
>dataBased Intelligence, Inc.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Post Reply
about | contact