sigo con el mismo ejemplo, lo que no puedo es cargar la selección del xbrowse en un array
- Code: Select all Expand view RUN
function asocio1(aElectro, nclia)
local oFac, odlg1
local z , n
local aItems := array(0)
aFacpago := Array(0)
if !pasaje("factura");return nil;endif
database oFac
oFac:setorder(3)
oFac:ordscope(0,nclia)
oFac:ordscope(1,nclia)
//oFac:gotop() */
// oFac:setfilter("paga" != "S" .and. "nota" != "C" .)
//FW_DbfToArray ( cFieldList, bFor, bWhile, nNext, nRec, lRest, aData )
//aRows := FW_DbfToArray( "DATE,TERMINAL,VALUE", { || FIELD->DATE = dDate } )
aItems := fw_dbftoarray("fechida,nota,nrofac,Importe,tipofac",{|| paga != "S" .and. nota != "C"})
oFac:deactivate()
xbrNumFormat( "E", .T. )
DEFINE DIALOG odlg1 resource "DIA_ASOCIO1"
redefine xBrowse oBrw Of odlg1 array aItems ; // Columns 'fechida','nrofac','Importe' ;
columns {1,2,3,4};
Headers 'Fecha','nota','Número', 'Abona';
JUSTIFY , .T., .T.,.T.;
ColSizes 80,40,120,180 id 101 UpDate Cell AutoSort
With Object oBrw:InsCol(1)
:bEditValue := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
:SetCheck()
:nHeadBmpNo := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
End
WITH OBJECT oBrw
:lDisplayZeros := .F.
:nMarqueeStyle := MARQSTYLE_HIGHLROWRC
:nStretchCol := STRETCHCOL_WIDEST
:bClrStd := { || { CLR_BLACK, Colores(oBrw:aRow[2]) } }
:lColDividerComplete := .T.
:lAllowColHiding := .F.
:lRecordSelector := .F.
END WITH
oBrw:bLClicked := { |r,c,f,oBrw| If( oBrw:MouseColPos( c ) == 1 , ;
If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0, ;
AAdd( oBrw:aSelected, oBrw:BookMark ), ;
ADel( oBrw:aSelected, f, .t. ) ), Nil ), ;
oBrw:RefreshCurrent() }
ACTIVATE DIALOG odlg1 ON INIT oBrw:gobottom()
if LEN(oBrw:aSelected) > 0
? Len(oBrw:aselected) (1)
FOR EACH z IN (oBrw:aSelected)
? oBrw:aArrayData[z,1] (2)
? oBrw:aArrayData[z,2]
AAdd(aFacpago,{oBrw:aArrayData[z,1] ,oBrw:aArrayData[z,2],oBrw:aArrayData[z,3],oBrw:aArrayData[z,4],oBrw:aArrayData[z,5]})
NEXT
? Len(aFacpago) (3)
FOR EACH z IN aFacpago
? aFacpago[z,1] (4)
NEXT
endif
return aFacpago
(1) muestra correctamente las filas seleccionados
(2) muestra correctamente los datos recorridos
(3) muestra correctamente la cantidad de elementos del array
(4) acá da este error
Error description: Error BASE/1068 Error de argumento: acceso al array
Args:
[ 1] = A { ... } length: 2
[ 2] = A { ... } length: 4
Stack Calls
===========
Called from: megandc1.prg => ASOCIO1( 2005 )
Called from: megandc1.prg => FACELECTRO( 1543 )
Indudablemente no entiendo como trabaja oBrw:aArrayData
Gracias por su atención
Luis