NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Array index out of bounds error using LabVIEW Microsoft Office Toolkit in TestStand

Hello Will,
 
I have read through the posts and tried to catch up on the issue but I have a few questions.  What versions of TestStand, LabVIEW, and the Report Generation Toolkit are you using (I think I missed that information)?  Also, you mentioned in one of your recent posts you were working on an updated version of the code and I was hoping I could get a look at this code in its current state.  I will try to take a deeper look at your code once I know which versions you are running so that I can properly recreate your situation.  Let me know if you have further questions, but this information would be greatly appreciated.
John B.
Applications Engineer
National Instruments
0 Kudos
Message 31 of 43
(3,311 Views)

Hi John,

I am using TestStand 3.5 (3.5.0.725), LabVIEW 8.0 and the Office Toolkit for Office 2003.

I believe now that the Run-TIme error is not caused by the Excel - Set Cell Color step.  That just where the program stops and generates the error.

I made a version of the program that skips over the steps where it reads data from the UUT and it did not work like the program that reads data from the UUT.

The error seems to be generated after it executes this step, Locals.Active_Faults_Before= Locals.Active_Faults_Now

This is where I move the current active faults read from the UUT into an array that stores them for comparison to the next set of active fault read from the UUT.

The code is attached to message 12 if you would like to look at it.

B.W.

 

 

 

 

0 Kudos
Message 32 of 43
(3,287 Views)

Hi John,

I ran a version of the code that does not get any data from the UUT last night, and it did not generate the Run-Time error.

I am thinking when the program tries to read the fault codes from the ECM, it may get some bad data sometimes and maybe this is what is causing the error.

It does not seem to be triggered until the step when the array that has the current fault data is copied into another array for comparison later to new data read into the current fault data array.

The error also does not happpen on this step, it happens in a later step, one that calls code from another support sequence (ex. Excel support sequence).

I am trying some things today, like changing the arrays to have upper and lower bounds of 0 during the operation of the program.

I was watching the program run one time when the Run-Time error occurred and 2 of the arrays had bounds of 0 (See the picture in message 19).

Any suggestions based on what you have seen so far.

B.W.

 

0 Kudos
Message 33 of 43
(3,269 Views)

Will,

Unfortunately I cannot run the code completely since I don't have all the subsequences and VIs but from your information and from some work with the code it seems like everything is conceptually sound but as you mention something goes wrong during the execution.  Since it works without the UUT information we might want to try running checks on the information we get back form it to prevent bad fault reports.  A simple test might be to put known data (simple strings/doubles) into the fault codes at the expected steps and run the program with that data to see if the problem occurs. This should prove whether its the data or the arrays that are causing this problem.  I will continue to look into this on my end and let you know if I come up with anything more concrete.

John B.
Applications Engineer
National Instruments
0 Kudos
Message 34 of 43
(3,233 Views)

Hi John,

Yesterday, I ran a version of the program that does not get data from the UUT with some added arrays that simulate reading fault codes from the UUT and the program ran fine.  No Run-Time error was generated.

I am now adding code to try and catch the problem with reading the faults in the original program.  If I find a problem with the Active_Faults_Now array, I will not copy it into the Active_Faults_Before array.

This will hopefully keep the Run-Time error from occurring.  I'll let you know if it works.

Thanks for the advice.

Will

0 Kudos
Message 35 of 43
(3,224 Views)
Will,
 
I just wanted to see how things were progressing with the changes to your program.  If you need any further assistance at this point please let me know.
John B.
Applications Engineer
National Instruments
0 Kudos
Message 36 of 43
(3,181 Views)
Hi John,
 
I believe that the step Get Active Fault Codes is causing the Run-Time Error.  I am now sending a report to the group that made this subsequence.  It was tough to track down because the Run-Time error pop up box does not occur on that step.  It usually happens on another step in the program that calls a subsequence after the Get Active Fault Codes step.
 
When I remove the step using Run Mode - Skip, the Run-Time Error does not occur.  I could not find a way to always detect when the error is going to occur.
 
Bill
 
 
0 Kudos
Message 37 of 43
(3,124 Views)
Will,
 
That is unfortunate you cannot directly edit the code to solve this issue.  Hopefully they can fix things, or possibly explain the return types and maybe then we can adapt some sort of fault detection.  Please let me know if there is any more I can assist with.
John B.
Applications Engineer
National Instruments
0 Kudos
Message 38 of 43
(3,099 Views)

Hello All,

After months of testing to find the cause of the Array index out of bounds error, we found the cause to be the use of the For Each loop!

The For Each loop went to access an element in the array that did not exist and caused the Run-Time error.  The error did not occur on that step in the sequence, it would occur on some other step in the sequence.  In the original version of the program it would always crash on the Excel -Set Cell Color step, which originally was thought as the cause of the error. 

Later it was thought that the Get Active Fault Code step, created within my company, was the cause.  The For Each loop that compared the previous fault codes to the current fault codes was found to be the cause.  The For Each loops were changed to For loops, and the sequence now runs without generating a Run-Time error.

Beware of the For Each loop! (see attachment)

Big_Will

0 Kudos
Message 39 of 43
(2,864 Views)

Big_Will,

Good to finally know what the source of the problem was!  To think we pegged the For Each loop as the problem, and then went back on that idea.  Oops! 

I am glad to hear that everything is cleared up and now we have a record of this on the forums for future reference.  Thanks Will.



Message Edited by herosphro on 06-26-2008 09:40 AM
John B.
Applications Engineer
National Instruments
0 Kudos
Message 40 of 43
(2,829 Views)