Sign in to follow this  
Followers 0
taxidelt

Counting number of matching elements in an array

3 posts in this topic

I am working on a system where I want to do a max number of failures in a rolling 100 piece count. I have an array

Running_Total_Parts ARRAY[0..100] OF UINT. 

I am wanting to know how many of the elements are equal to UINT#7.

What I am confused on is in the instructions they like to use the word they are defining in the definition. 

Member's Meaning is "Member to search" 

Key's meaning is Search key. 

I am confused on what I should put into the information for those variables. 

in the help file it has the following variables. Please correct me if what I am describing in the () after the variable names are incorrect.

IN: abc[0] (this is the name of the array) 

Size= UINT#5 (first five uint elements in the array)

Member= abc[0].m (I am unsure of how I know which value to fill in for "M")

Key= INT#1234 ( this is the value searching for within the array) 

Mode= _Linear ( I am unsure what these modes mean) 

InOutPos= def[0] (element numbers that match the search key)

Num= jkl (this I am assuming is the variable that will be filled with the number matching elements in the array). 

 

This is the first project I'm working on in Sysmac so trying to fully understand their help files has been a chore at times. 

 

Thank you in advance for your time. 

 

 

Share this post


Link to post
Share on other sites

Looks like you are trying to use RecSearch. This is beneficial when you have an array of structures and you want to search within one of the structures of your array.
That is what Member In[0].m is referring to. 

Since you are doing a search within a single dimensional array you could try just use ArySearch.
ArySearch works if you do not have various "member" in your array.

ArySearch2.png

ArySearch.png

ArySearch1.png

1 person likes this

Share this post


Link to post
Share on other sites

That was exactly what I was looking for. Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0