Page 1 of 1

ERROR WITH XBROWSE : TOEXCEL

Posted: Thu Apr 21, 2011 11:59 am
by Silvio
Image

I HAVE A XBROWSE and I MADE

ACTION (CursorWait(), oApp():oGrid:ToExcel(), CursorArrow());

and it made an error why ?????

Application
===========
Path and name: C:\Work\Prg2\rux\main.Exe (32 bits)
Size: 3,516,416 bytes
Time from start: 0 hours 1 mins 9 secs
Error occurred at: 21-04-2011, 13:56:33
Error description: Error BASE/2022 Parametro errato: ALLTRIM
Args:
[ 1] = N 2

Stack Calls
===========
Called from: => ALLTRIM(0)
Called from: Lib\xbrowse.prg => TXBRWCOLUMN:CLPTEXT(11000)
Called from: Lib\xbrowse.prg => TXBRWIN7:CLPROW(6149)
Called from: Lib\xbrowse.prg => TXBRWIN7:TOEXCEL(6714)
Called from: source\Rux.prg => (b)RUX(319)

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Thu Apr 21, 2011 3:10 pm
by nageswaragunupudi
1) Please try setting oBrw:lExcelCellwise := .t., before calling oBrw:ToExcel(). You will not get this error.

2) The reason for error must be due to assigning a codeblock to oCol:bStrData returning a non-character value.
(a) Usage of bStrData has been deprecated long time back and it is recommended to use bEditValue. However, assignment to bStrData works for the sake of backward compatibility though many other features of xbrowse are not available in that case.
(b) As the name bStrData implies, ( string data ), the codeblock is expected to return a character value. Though efforts have been made to accommodate inadvertent assignment of codeblocks returning non-character values but only to the extent of display in the browse.
(c) Recommend using bEditValue instead of bStrData.

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Fri Apr 22, 2011 8:33 am
by Silvio
thanks Rao,

a Question :

I use

FOR i := 1 TO Len(aBrowse)
oCol := oApp():oGrid:AddCol()
oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
if !Empty(aBrowse[ i, 4 ])
oCol:cEditPicture:=aBrowse[ i, 4 ]
Endif
NEXT


I must insert oCol:bEditValue := aBrowse[ i, 1 ] instead of oCol:bStrData := aBrowse[ i, 1 ]

I understood ?

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Fri Apr 22, 2011 8:38 am
by Silvio
I tried ... all run ok you're fantastic !!

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Fri Apr 22, 2011 5:18 pm
by nageswaragunupudi
I must insert oCol:bEditValue := aBrowse[ i, 1 ] instead of oCol:bStrData := aBrowse[ i, 1 ]
Yes.
Glad it works.

This is just for information:
You first define all parameters in an array and then populate the codeblocks, headers, etc to columns of xbrowse.
This is very much simplified in the recent versions of xbrowse.

Define a multi-dimensional array in this format:
aCols := { ;
{ <uData1>, [<cHeader1>], [<cPicture1>], [<nWidth1>], [<lnJustify1>], [<cnSort1>] }, ;
....
{ <uDataN>, [<cHeaderN>], [<cPictureN>], [<nWidthN>], [<lnJustifyN>], [<cnSortN>] }}

Second element onwards are optional.

Simply write
@ 0,0 XBROWSE oBrw OF oWnd COLUMNS aCols DATASOURCE <uDataSource>

XBrowse autmatically assigns all the parameters to columns.

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Fri Apr 22, 2011 9:36 pm
by Silvio
Have you a minimal sample for this DATASOURCE command ?

Re: ERROR WITH XBROWSE : TOEXCEL

Posted: Fri Apr 22, 2011 11:15 pm
by nageswaragunupudi
We can write DATASOURCE instead of writing ARRAY,ALIAS, etc.