Página 1 de 1

SaveToArray problem

Publicado: Sab Jul 18, 2009 7:27 pm
por g.s.rogers
When I try to save an array to aItems of a combobox control using this:
// look up codes for DMO's filtered by county civil module
::oDbfDataSetDMOCodes:Filter("CADOCUMT->MODULE == 'CCIVIL '")
oSender:aItems := ::oDbfDataSetDMOCodes:SaveToArray(
{"DOCUCODE","DOCUDESC"} )
oSender:aItemsBound := ::oDbfDataSetDMOCodes:SaveToArray(
{"DOCUCODE","DOCUDESC"} )
I get this error:
Subsystem Call: BASE
System Code: 1101
Default Status: .F.
Description: Argument error
Operation: LTRIM
Arguments: [ 1] = Type: A Val:
Involved File:
Dos Error Code: 0
I have the nDataType of the control set to dtBOUND and the nStyle set to
cDROPDOWNLIST. The combobox works with a single value, but not with the
above array. What am I doing wrong?
TIA,
Gary

SaveToArray problem

Publicado: Lun Jul 20, 2009 11:52 am
por ignacio
Gary,
I am afraid there is not any call to function LTRIM() on method SaveToArray(). Please send a sample:
//---------------------------------------------------------- ----------------
METHOD SaveToArray( aFields, bFor, bWhile ) CLASS XDbfDataSet
LOCAL aData := {}
LOCAL aTemp
LOCAL xValue
LOCAL bEval
LOCAL nFor
IF aFields == NIL
aFields := {}
Aeval( ::aFields, {|v| Aadd( aFields, v:cDbfName ) } )
ENDIF
IF Valtype( aFields ) != "A"
aFields := { aFields }
ENDIF
FOR nFor := 1 TO Len( aFields )
xValue := aFields[ nFor ]
IF Valtype( xValue ) == "C"
aFields[ nFor ] := COMPILAR( ::cAlias + "->" + xValue )
ENDIF
NEXT
IF Len( aFields ) == 1
bEval := {|| AAdd( aData, Eval( aFields[ 1 ], Self, Len( aData ) + 1 ) ) }
ELSE
aTemp := Array( Len( aFields ) )
bEval := {|| AEval(aFields, {|v, e| aTemp[ e ] := Eval( v, Self ) } ), AAdd(aData, AClone( aTemp ) ) }
ENDIF
::SaveState()
( ::cAlias )->( DbEval( bEval, bFor, bWhile ) )
::RestoreState()
RETURN aData
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:4a6205ec$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> When I try to save an array to aItems of a combobox control using this:
>
> // look up codes for DMO's filtered by county civil module
> ::oDbfDataSetDMOCodes:Filter("CADOCUMT->MODULE == 'CCIVIL '")
> oSender:aItems := ::oDbfDataSetDMOCodes:SaveToArray(
> {"DOCUCODE","DOCUDESC"} )
> oSender:aItemsBound := ::oDbfDataSetDMOCodes:SaveToArray(
> {"DOCUCODE","DOCUDESC"} )
>
> I get this error:
>
> Subsystem Call: BASE
> System Code: 1101
> Default Status: .F.
> Description: Argument error
> Operation: LTRIM
> Arguments: [ 1] = Type: A Val:
> Involved File:
> Dos Error Code: 0
>
> I have the nDataType of the control set to dtBOUND and the nStyle set to
> cDROPDOWNLIST. The combobox works with a single value, but not with the
> above array. What am I doing wrong?
> TIA,
> Gary
>
>
--

SaveToArray problem

Publicado: Lun Jul 20, 2009 11:52 am
por ignacio
Gary,
I am afraid there is not any call to function LTRIM() on method SaveToArray(). Please send a sample:
//---------------------------------------------------------- ----------------
METHOD SaveToArray( aFields, bFor, bWhile ) CLASS XDbfDataSet
LOCAL aData := {}
LOCAL aTemp
LOCAL xValue
LOCAL bEval
LOCAL nFor
IF aFields == NIL
aFields := {}
Aeval( ::aFields, {|v| Aadd( aFields, v:cDbfName ) } )
ENDIF
IF Valtype( aFields ) != "A"
aFields := { aFields }
ENDIF
FOR nFor := 1 TO Len( aFields )
xValue := aFields[ nFor ]
IF Valtype( xValue ) == "C"
aFields[ nFor ] := COMPILAR( ::cAlias + "->" + xValue )
ENDIF
NEXT
IF Len( aFields ) == 1
bEval := {|| AAdd( aData, Eval( aFields[ 1 ], Self, Len( aData ) + 1 ) ) }
ELSE
aTemp := Array( Len( aFields ) )
bEval := {|| AEval(aFields, {|v, e| aTemp[ e ] := Eval( v, Self ) } ), AAdd(aData, AClone( aTemp ) ) }
ENDIF
::SaveState()
( ::cAlias )->( DbEval( bEval, bFor, bWhile ) )
::RestoreState()
RETURN aData
Regards,
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Gary S. Rogers" <g.s.rogers@att.net> escribió en el mensaje news:4a6205ec$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> When I try to save an array to aItems of a combobox control using this:
>
> // look up codes for DMO's filtered by county civil module
> ::oDbfDataSetDMOCodes:Filter("CADOCUMT->MODULE == 'CCIVIL '")
> oSender:aItems := ::oDbfDataSetDMOCodes:SaveToArray(
> {"DOCUCODE","DOCUDESC"} )
> oSender:aItemsBound := ::oDbfDataSetDMOCodes:SaveToArray(
> {"DOCUCODE","DOCUDESC"} )
>
> I get this error:
>
> Subsystem Call: BASE
> System Code: 1101
> Default Status: .F.
> Description: Argument error
> Operation: LTRIM
> Arguments: [ 1] = Type: A Val:
> Involved File:
> Dos Error Code: 0
>
> I have the nDataType of the control set to dtBOUND and the nStyle set to
> cDROPDOWNLIST. The combobox works with a single value, but not with the
> above array. What am I doing wrong?
> TIA,
> Gary
>
>
--