Normal Topic Array index overflow - @Save (Read 1126 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Array index overflow - @Save
Mar 14th, 2004 at 8:39pm
Print Post Print Post  
Just started getting two error messages as a pair:
Quote:
Array index overflow error
followed by
Quote:
A runtime Sbasic error has occurred.  Please close this form and repair the condition before continuing.


Steps:
Open Application
Open Add Form
Message comes up right away.

Thoughts:
Most recent changes were the inclusion of @SAVE command.  Was trying to troubleshoot why I have been unable to save a record, and proceed to next record.  No error message, no indication of a problem.  Cursor just sits in last element.

Current:  Removed lines with @Save and problem goes away.  Discovered that pressing F10 does not save a record either.  But Pressing F10 does not generate the error message.
« Last Edit: Mar 15th, 2004 at 1:41am by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Andreas
Lanticans
*****
Offline



Posts: 8
Location: Germany
Joined: Nov 22nd, 2002
Re: Array index overflow - @Save
Reply #1 - Mar 15th, 2004 at 6:34am
Print Post Print Post  
The error message indicates that while working with an array, you used in index which is larger (or smaller) than the arrays dimension, like in:

var a as array[ 100 ] of string
writeln( a[101] )
writeln( a[0] )
I suggest that you check all your array related code.

Andreas.
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Array index overflow - @Save
Reply #2 - Mar 15th, 2004 at 3:39pm
Print Post Print Post  
Thanks for suggestion Andreas, but no arrays at all in the code..  Oops, sorry, just found one array......could be it!

Generic question:  When cursor is in an element, and F10 is pressed to Save the record, does that execute the code in the ElementExitEvent section for that element?  I am hoping that it does not.  I would think that only fires when it loses focus, but  perhaps Saving a record is treated the same way?  (Actually I can test that for myself later tonight).  I am not suggesting this is happening, but also not ruling it out.  And want to be sure in my mind about the timing of event firing triggers.

Will have to wait until later tonight to do any more analysis.
« Last Edit: Mar 15th, 2004 at 5:07pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Array index overflow - @Save
Reply #3 - Mar 16th, 2004 at 1:09am
Print Post Print Post  
That did it! Grin     Thanks Andreas.

And I did check about ExitElementEvents.  They do not appear to execute when pressing F10 to Save.   Which is what I expected,
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Array index overflow - @Save
Reply #4 - Mar 16th, 2004 at 1:16am
Print Post Print Post  
Quote:
They do not appear to execute when pressing F10 to Save.

Are you sure?  I created a simple db application that uses WriteLN() to show exactly what order the programming is firing in.  I find that the OnElementExit programming is executing when I press F10.

You can download it here http://www.newenglandantenna.com/sesame/Order%20Of%20Programming%20Events.zip
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Array index overflow - @Save
Reply #5 - Mar 16th, 2004 at 6:48am
Print Post Print Post  
Hi Carl...Am I sure?  NO, not always.  A close look at my update was that they "do not appear to execute".  I was very specific not to say it absolutely.

For this test I did the following:
Put a simple program in element1 ExitElementEvent that was something like: element2  = "I WAS UPDATED".
I had my cursor in element1, pressed F10.  Went back to look at record and element2 was still empty.

I also also done some routines to understand the Event sequence (see earlier posts at http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...) but it does not appear to be consistent.  I suspect that what we are seeing in the testing is a WriteLn that says something may have been called, but there may be underlying conditional logic that actually controls if anything happens.  Using WriteLn can only show us the possible firing sequence, but doesn't really tell us if anything is executed.  Example, ElementExitEvent may be called but logic could say something like: "IF @SAVE THEN CNEXT".   That is why I thought actually watching result might be better. 

But since there is most likely underlying logic, just because it worked properly (did not execute) this time, that there might be some other conditions under which it might.

I feel more comfortable now that I have tested it.  It was just one of those random thoughts you get when trying to troubleshoot......"what could possibly be going wrong?" routines.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Array index overflow - @Save
Reply #6 - Mar 16th, 2004 at 1:37pm
Print Post Print Post  
Quote:
...but it does not appear to be consistent.  I suspect that what we are seeing in the testing is a WriteLn that says something may have been called, but there may be underlying conditional logic that actually controls if anything happens.  Using WriteLn can only show us the possible firing sequence, but doesn't really tell us if anything is executed.

I am seeing very consistant results.  I added code to cause Element A to display the same messages as WriteLn -- and except for Global Code, everything came up identical in the element and the WriteLn window.  I tried removing the WriteLn programming, in case that made a difference -- still the same events fired in the same order.

I wonder if there is a corruption problem with your db?

(At one point I thought I saw the same result you described.  But I made the mistake of using something like "A = ..." rather than "A += ...", so of course I only saw the last code that fired, not all of them.  I have never seen the OnElementExit programming not execute.)
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Array index overflow - @Save
Reply #7 - Mar 16th, 2004 at 11:25pm
Print Post Print Post  
Well, currently, I don't have a problem.  I did have an array left over from ealier work, forgot it was there, and other changes caused it to overflow. 

It was just while trying to understand what was wrong, I had a situation that might have been a problem if the ExitElementEvent  triggered when F10 was pressed to Save.  I am comfortable that that does not happen.  The actual cause was wrong array dimensions.

Thanks for your inputs Carl.......
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Array index overflow - @Save
Reply #8 - Mar 16th, 2004 at 11:58pm
Print Post Print Post  
OK... but I still insist Grin that it does execute, and that you must have something else that is preventing it in your case.  Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged