09-16-2020 04:06 AM
Hello,
I'm filling an array in a subsequence with an unknown quantity of datas (list of defects).
I update the upper bound of this array each time the operator want to add a new defect.
My issue is that I don't succeed to get this array from the main sequence because I don't know how many elements there are in my array.
Is there a trick to do this ?
(I'm sorry, but i'm not able to share my teststand sequence because of the internal policy of my company)
Thanks a lot in advance,
Jonathan
Solved! Go to Solution.
09-16-2020 05:48 AM
Hello Jonathan,
If I understand correctly your question, than the answer is below:
Locals.A - the array of elements where you want to increment the size.
Locals.NumberOfElements - just a variable where we store the current size, we increase it and than set it back to Locals.A.
Se code below
Locals.NumberOfElements = Locals.A.GetNumElements(),
Locals.NumberOfElements++,
Locals.A.SetNumElements(Locals.NumberOfElements)
09-16-2020 06:17 AM
Thanks for your reply, but I think you misunterstanded my question :
I know how to adjust the size of my array inside the sub sequence, but how can I get this array from the main sequence without knowing in advance how many elements there are?
09-16-2020 06:21 AM
Where do you want to get it?
You said you want to get it from main sequence, where to?
09-16-2020 06:40 AM
Here is an exemple of what I want to do :
- In the subsequence, I have an empty array that I'm filling with the quantity of defects the operator found
- In the mainSequence, I want to get back the array to analyze and report it. But I can't set an array because I don't know in advance how many elements there will be in my subSequence "Array" parameter
I hope to be clear enough
09-16-2020 06:59 AM
If you pass the parameter by reference (and you do according to the screenshot), you don't need to worry to match the size of the array.
The Subsequence will modify automatically the size of the input array.
I have just tested with a simple sequence where I am passing an empty array of strings, in the SubSequence I get the current size and increase it by one.
Calling multiple times the same subsequence, I see my original array (empty created) increased in size.
See the screenshot below.
09-16-2020 07:06 AM - edited 09-16-2020 07:07 AM
Oh, I feel ashamed, I would have sworn that we MUST match parameters type/dimensions.
Thanks a lot, and sorry for this uninteresting question.
09-16-2020 07:15 AM
No worries 😉 Glad that I could help!
You can help other users on the forum so that we keep paying it forward 🙂
Cheers,
Just a TSUser