FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oBrw:ToExcel() error
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
oBrw:ToExcel() error
Posted: Tue Mar 05, 2013 09:51 PM
Hi everyone;

I'm seen an error when exporting from xbrowse using :ToExcel(). Error text is:
Code (fw): Select all Collapse
Error Excel.Application.ACTIVESHEET/424 Unknown error: CELLS
...
Stack-List
Called by TXBROWSE:TOEXCEL(6935)


Any ideas?


Thank you,


Reinaldo.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oBrw:ToExcel() error
Posted: Wed Mar 06, 2013 12:17 AM

We need to see what is the code in line 6935.
Very likely, such an error could arise when the parameters of Cells(...) are invalid or invalid assignment.

Regards



G. N. Rao.

Hyderabad, India
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: oBrw:ToExcel() error
Posted: Fri Mar 08, 2013 09:32 PM
Hi.

The line at 6935 is this:
Code (fw): Select all Collapse
                     oSheet:Cells( nPasteRow, 1 ):Select()


The parameters reported on the error log are:

[ 1 ] = N 353213
[ 2 ] = N 1

Again the error text is:

Error Excel.Application: ACTIVE SHEET/1 Unknown error: CELLS.

Information on how to solve this problem, is appreciated.

Thank you,


Reinaldo.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oBrw:ToExcel() error
Posted: Sat Mar 09, 2013 04:43 AM
[ 1 ] = N 353213

This is the reason. Here nPasteRow's value appears to be beyond the limit.
If the code of xbrowse is bug-free ( let us assume so for the time being ), this value should not exceed the total rows in the table. If the table really contains more rows than 352,213 then we now know that this number seems to be the limit and so we need to export subsets of the table.


Check #1: Does the table really contain more rows than the limit?
If so please consider exporting subsets of table.
Check #2: Does Eval( oBrw:bKeyCount() ) correctly return the number of rows in the table?
If not check the codeblocks for oBrw:bKeyCount() .and. oBrw:bSkip
Check #3:
We need to investigate why the number is so high. I request your cooperation in the logging the relevant values to a log file in the loop.

Please locate this part of the program code in toExel() method and insert the lines I indicated:
Code (fw): Select all Collapse
               
               ferase( 'x.log' ) // INSERTED
               logfile( 'x.log', { nRow, nPasteRow, nDataRows } )  // INSERTED              
               do while nRow <= ( nDataRows + 1 ) .and. lContinue
                  if ! Empty( cText )
                     cText += CRLF
                  endif
                  cText    += ::ClpRow( .t., aCols )

                  lContinue := ( ::Skip( 1 ) == 1 )            // Eval( ::bSkip, 1 )
                  nRow ++
                  if nRow % 1000 == 0 .or. nRow > 353000  // INSERTED
                     logfile( 'x.log', { nRow, nPasteRow, nDataRows } )   // INSERTED
                  endif // INSERTED


Examine the log file after termination of the program.
Regards



G. N. Rao.

Hyderabad, India
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: oBrw:ToExcel() error
Posted: Sat Mar 09, 2013 02:53 PM

Mr. Rao;

Hi. Thank you for the information.

The error log is being saved to a systemerrors table. I get to inspect the table on a daily base looking for bugs. However, I don't have an installation where the program is used by less than 70 users and although I do know the login user's name that generates the runtime error, I do not have access to c: drive of each workstation. Therefore loggin to x.log will not help. Loggin to a shared drive won't help either as x.log would be re-written time and again by many users.

I will try to log to a table each time this piece of code executes and hopefully I will be able to match the runtime error to it. Trying to export 353k records to excel does not make any sense to me. In theory users may set a filter and then try to export to excel that subset that passes the filter condition. Filters are created using AOFs. bKeyCount() might be the problem here as it might not be respecting filters ...? If so, then this is something I can fix.

I'll get back when I have more info.

Thank you,

Reinaldo.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: oBrw:ToExcel() error
Posted: Sat Mar 09, 2013 03:16 PM
bKeyCount() might be the problem here as it might not be respecting filters ...?

Likely.

Actually the Loop should end when either nRow > Eval( bKeyCount ) .or. Eval( bSkip, 1 ) != 1, whichever happens first.

You can try checking behavior of these codeblocks.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion