04-26-2013 10:48 AM
hi,
I know how to check with array with variables but i am not sure how to check for array with strings......
Pls let me know.
thanks
04-26-2013 11:04 AM
Are you looking to see if an array of strings is empty? getnumelements(array name) == 0
Are you looking to see if an array of strings has an empty string in it? Use a FOR loop to go through each element and perform a check with an empty string ("").
04-26-2013 01:54 PM
I have declared the array with string and I need to check whether this array has any strings present or not......
04-26-2013 02:24 PM
I'm still not following you.
Ok, you have an array of strings. Is the array declared as a certain size or start off empty? Are you adding and removing elements from the array? Can you show some code to demonstrate your setup?
04-26-2013 02:42 PM
size of Array of string is declared as a empty under parameter......in future i may add strings to that array and i need to check whether array is empty or not before procedding with other conditions.......
Ex:
parameters.string Arr[]
if (parameters.string arr[] == empty)
failed
else
a= name 1 = name 2
So i need to check string arr[] is empty or not
if (parameters.string arr[] is not empty)
b= name2 + name 3
else
a= name 1 = name 2
pls let me know
thanks,
chethan
I'm still not following you.
Ok, you have an array of strings. Is the array declared as a certain size or start off empty? Are you adding and removing elements from the array? Can you show some code to demonstrate your setup?
04-26-2013 04:20 PM
Use the GetNumElements function:
locals.empty = (getnumelements(parameters.array) == 0)
04-26-2013 04:22 PM
Mandya,
Crossrulz already gave you the solution in his first post. You need to use the GetNumElements function in an expression. This function takes an array as its parameter and returns the number of elements in the array.
So GetNumElements(Parameters.MyArray) == 0
From the TestStand help:
Number GetNumElements(Array array)
This function returns the number elements in an array.
Parameter 1: A single dimensional array.
Returns: The number of array elements.
Cheers,
05-02-2013 10:19 AM
can i use same concept for contianer also
i mean getnumelements(parameters.container.arr1)...pls let me know
05-02-2013 10:29 AM
@Mandya wrote:
can i use same concept for contianer also
i mean getnumelements(parameters.container.arr1)...pls let me know
It looks like you are still looking at an array. It is just inside of a container. Should have no problems.
05-02-2013 11:44 AM
what is