Página 1 de 1

DataSet assignment of Numeric ... thinks its a Character ?

Publicado: Mié May 02, 2007 6:20 pm
por ChrisGillard
Hi,
The following code snippet gives odd results.
The first 6 fields get to database OK.
The PALLETS field gets a message like
'FieldPut expects a N & received a C'
This makes no sense as nPallets or the direct assignment of 34 are visibly numeric.
PALLETS field on dbf is N4
//////////////////////////////////////////////////////////// ////////
oDiaryDs:AddNew()

oDiaryDS:TRANNO := nTranno
oDiaryDS:DELYDATE := ::oParent:dSelectedDate
oDiaryDS:DELYTIME := alltrim( cDelyTime )
oDiaryDS:SUPPID := ::oSuppIDEdit:Value
oDiaryDS:SUPPNAME := ::oSuppNameEdit:Value
oDiaryDS:PONUMB := val( ::oPoNumEdit:Value )

logdisplay( "nPallets", nPallets, valtype( nPallets ) ) This confirms nPallets is NUMERIC

oDiaryDS:PALLETS := nPallets
// oDiaryDS:PALLETS := 34 This has same result.
oDiaryDS:Update()

/////////////////////////////////////////////////////////
I have replaced this code with traditional aliassed field replaces & it works fine.
Am trying to isolate the problem in a small project.
Any thoughts please??
Chris
Chris Gillard
Blue Square Software
02380 458737
www.bluesquare.co.uk

DataSet assignment of Numeric ... thinks its a Character ?

Publicado: Mié May 02, 2007 6:49 pm
por ignacio
Chris,
Is there any datacontrol linked to that Pallets field? Surely that
DataControl is causing the problem. BTW if there are not any DataControls
involved on the append operation is better and faster to use FastAddNew()
and FastUpdate().
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Chris Gillard" <chris@bluesquare.co.uk> escribió en el mensaje
news:[email=200752172054.182909@xccube...]200752172054.182909@xccube...[/email]
Hi,
The following code snippet gives odd results.
The first 6 fields get to database OK.
The PALLETS field gets a message like
'FieldPut expects a N & received a C'
This makes no sense as nPallets or the direct assignment of 34 are visibly
numeric.
PALLETS field on dbf is N4
//////////////////////////////////////////////////////////// ////////
oDiaryDs:AddNew()
oDiaryDS:TRANNO := nTranno
oDiaryDS:DELYDATE := ::oParent:dSelectedDate
oDiaryDS:DELYTIME := alltrim( cDelyTime )
oDiaryDS:SUPPID := ::oSuppIDEdit:Value
oDiaryDS:SUPPNAME := ::oSuppNameEdit:Value
oDiaryDS:PONUMB := val( ::oPoNumEdit:Value )
logdisplay( "nPallets", nPallets, valtype( nPallets ) ) This confirms
nPallets is NUMERIC
oDiaryDS:PALLETS := nPallets
// oDiaryDS:PALLETS := 34 This has same result.
oDiaryDS:Update()
/////////////////////////////////////////////////////////
I have replaced this code with traditional aliassed field replaces & it
works fine.
Am trying to isolate the problem in a small project.
Any thoughts please??
Chris
Chris Gillard
Blue Square Software
02380 458737
www.bluesquare.co.uk

DataSet assignment of Numeric ... thinks its a Character ?

Publicado: Mié May 02, 2007 7:31 pm
por ChrisGillard
Ignacio,
You are right ...
There is a data aware edit for PALLETS on the same form ... it shows the details of the record highlighted in the main browse. It is ! editable & !enabled so only is a 'show' control.
I suspect this is causing the problem.
FastAddNew/FastUpdate ... another approch, there is a lot to learn!
I have gone back to direct XDIARY->( dbappend() ), XDIARY->PALLETS := NN for all the record update fields for now to keep things simple.
I may also move away from data aware controls for a while ... I seem to remember from Delphi that they sometimes cause as many problems as they solve.
What is really good about xailer is how you can mix the technologies, moving to the more object stuff as you learn.
I will be buying xailer tomorrow ... if everyone back at work.
Thanks very much for your help, it makes learning & progress much quicker.
Regards
Chris
Chris Gillard
Blue Square Software
02380 458737
www.bluesquare.co.uk
On Wed, 2 May 2007 17:49:41 +0100, Ignacio Ortiz de Zúñiga wrote:
> Chris,
>
> Is there any datacontrol linked to that Pallets field? Surely that
> DataControl is causing the problem. BTW if there are not any
> DataControls involved on the append operation is better and faster
> to use FastAddNew() and FastUpdate().
>
> Regards,
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Chris Gillard" escribió en el mensaje
> news:[email=200752172054.182909@xccube...]200752172054.182909@xccube...[/email] Hi,
>
> The following code snippet gives odd results.
>
> The first 6 fields get to database OK.
>
> The PALLETS field gets a message like
>
> 'FieldPut expects a N & received a C'
>
> This makes no sense as nPallets or the direct assignment of 34 are
> visibly numeric.
>
> PALLETS field on dbf is N4
>
> //////////////////////////////////////////////////////////// ////////
>
> oDiaryDs:AddNew()
>
> oDiaryDS:TRANNO := nTranno
> oDiaryDS:DELYDATE := ::oParent:dSelectedDate
> oDiaryDS:DELYTIME := alltrim( cDelyTime )
> oDiaryDS:SUPPID := ::oSuppIDEdit:Value
> oDiaryDS:SUPPNAME := ::oSuppNameEdit:Value
> oDiaryDS:PONUMB := val( ::oPoNumEdit:Value )
>
> logdisplay( "nPallets", nPallets, valtype( nPallets ) ) This
> confirms nPallets is NUMERIC
>
> oDiaryDS:PALLETS := nPallets
> // oDiaryDS:PALLETS := 34 This has same result.
>
> oDiaryDS:Update()
>
> /////////////////////////////////////////////////////////
>
> I have replaced this code with traditional aliassed field replaces
> & it works fine.
>
> Am trying to isolate the problem in a small project.
>
> Any thoughts please??
>
> Chris
>
> Chris Gillard
> Blue Square Software
> 02380 458737
> www.bluesquare.co.uk

DataSet assignment of Numeric ... thinks its a Character ?

Publicado: Mié May 02, 2007 8:10 pm
por ignacio
Chris,
Instead of assigning the value directly on the dataset, assign it to the
datacontrol:
::oMyEdit:Value := nPallets
This is important when there are datacontrols linked to the dataset because
the value assigned manually by you maybe replaced automatyically by the
datacontrol when is 'Updated'.
BTW, surely you are using a TDBEdit for the pallets field. Be aware that
TEdit and TDBEdit only work with character values. You should use
TDBMaskEdit in cases the type is different.
Please contact our sales dept. tomorrow to make your order. Sorry for any
inconvenience.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Chris Gillard" <chris@bluesquare.co.uk> escribió en el mensaje
news:[email=200752183155.232292@xccube...]200752183155.232292@xccube...[/email]
Ignacio,
You are right ...
There is a data aware edit for PALLETS on the same form ... it shows the
details of the record highlighted in the main browse. It is ! editable &
!enabled so only is a 'show' control.
I suspect this is causing the problem.
FastAddNew/FastUpdate ... another approch, there is a lot to learn!
I have gone back to direct XDIARY->( dbappend() ), XDIARY->PALLETS := NN
for all the record update fields for now to keep things simple.
I may also move away from data aware controls for a while ... I seem to
remember from Delphi that they sometimes cause as many problems as they
solve.
What is really good about xailer is how you can mix the technologies, moving
to the more object stuff as you learn.
I will be buying xailer tomorrow ... if everyone back at work.
Thanks very much for your help, it makes learning & progress much quicker.
Regards
Chris
Chris Gillard
Blue Square Software
02380 458737
www.bluesquare.co.uk
On Wed, 2 May 2007 17:49:41 +0100, Ignacio Ortiz de Zúñiga wrote:
> Chris,
>
> Is there any datacontrol linked to that Pallets field? Surely that
> DataControl is causing the problem. BTW if there are not any
> DataControls involved on the append operation is better and faster
> to use FastAddNew() and FastUpdate().
>
> Regards,
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Chris Gillard" escribió en el mensaje
> news:[email=200752172054.182909@xccube...]200752172054.182909@xccube...[/email] Hi,
>
> The following code snippet gives odd results.
>
> The first 6 fields get to database OK.
>
> The PALLETS field gets a message like
>
> 'FieldPut expects a N & received a C'
>
> This makes no sense as nPallets or the direct assignment of 34 are
> visibly numeric.
>
> PALLETS field on dbf is N4
>
> //////////////////////////////////////////////////////////// ////////
>
> oDiaryDs:AddNew()
>
> oDiaryDS:TRANNO := nTranno
> oDiaryDS:DELYDATE := ::oParent:dSelectedDate
> oDiaryDS:DELYTIME := alltrim( cDelyTime )
> oDiaryDS:SUPPID := ::oSuppIDEdit:Value
> oDiaryDS:SUPPNAME := ::oSuppNameEdit:Value
> oDiaryDS:PONUMB := val( ::oPoNumEdit:Value )
>
> logdisplay( "nPallets", nPallets, valtype( nPallets ) ) This
> confirms nPallets is NUMERIC
>
> oDiaryDS:PALLETS := nPallets
> // oDiaryDS:PALLETS := 34 This has same result.
>
> oDiaryDS:Update()
>
> /////////////////////////////////////////////////////////
>
> I have replaced this code with traditional aliassed field replaces
> & it works fine.
>
> Am trying to isolate the problem in a small project.
>
> Any thoughts please??
>
> Chris
>
> Chris Gillard
> Blue Square Software
> 02380 458737
> www.bluesquare.co.uk