NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

GoTo Setup from Cleanup in the same sequence

Hi,

I am trying to get a sequence, using the NI parallel model, to do the following:

- Two FileGlobals: NumberofLoops=5, LoopIndex=0
- Run Setup
- Run Main
- Run Cleanup
- In Cleanup the program should jump back to Setup while: FileGlobals.NumberofLoops<>FileGlobals.LoopIndex, otherwise the code should finish.

I can't upload my full project. As a resul I have attached a simple program that just prompts where the code is and this will tell me if the code works or not.

Does anyone know the expression or how to setup the GoTo Function to carry this out?

0 Kudos
Message 1 of 7
(4,100 Views)
Hi,
 
Hopefully this link will help you.
 
 
Regards
Ray
Regards
Ray Farmer
0 Kudos
Message 2 of 7
(4,090 Views)
Thanks for that Ray it works brilliantly.

It does cause me one issue though. I read my results from Locals.ResultList Array. As a result of loop into the Setup from the Cleanup, the Array isn't getting initialised. I have tried copying the Array and calling it Locals.InitialiseResultsList. Then at the end of the Cleanup I insert a statement:

Locals.ResultList=Locals.InitialiseResultList

Unfortunately this didn't work......any ideas?
0 Kudos
Message 3 of 7
(4,075 Views)

Hi,

Do you mean that if you jump back to the Setup that all the results collected for that sequence are discarded?

Have you tried just deleting the elements from the ResultList array. If you get the Number of elements in ResultList then call PropertyObject.DeleteElements(0, numberof elements, 0), this will set the array empty.

Of course dont forget to switch off the result recording of any steps you add  to do this task, other wise you will find that you will have the DeleteElements step result still in ResultList.

Hope this helps

Ray

 

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(4,068 Views)
Hi Ray,

Thanks for your input. I actually got it working another way.

I looked into your solution but when I put in the PropertyObject.DeleteElement(0,4,0) where 4 is the number of elements in the array, Teststand reported an error. How do I link the "PropertyObject" to Locals.ResultList?

Thanks again
0 Kudos
Message 5 of 7
(4,065 Views)
Hi,
 
Use Locals.ResultList as the ActiveX reference in the Automation Call. For the number of elements you can use the function GetNumElements(Locals.ResultList) to obtain the number of elements.
 
So your call would look like
Call PropertyObject.DeleteElements(0, GetNumElements(Locals.ResultList), 0) (as seen when you highlight the description field)
 
You could use the Statement step, and use the function
     RemoveElements(Locals.ResultList, "[0]", GetNumElements(Locals.ResultList))
 
This should give the same effect of emptying the array.
 
Regards
Ray
 
 
Regards
Ray Farmer
0 Kudos
Message 6 of 7
(4,063 Views)
Ray,

All sorted out now. Thanks for your help.

0 Kudos
Message 7 of 7
(4,039 Views)