Searching for Unique Values

Steve Etter

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Morristown, TN
Posts
965
Hi everybody. I'm working with RSLogix5000 and looking to create a database of part numbers and corresponding critical values. To use this database, I will have a PanelView Plus touchscreen where the operator will be able to input new part numbers & values and store them.

My question is this - When the operator triggers the "Store" command, I would like for the program to compare the new part number with all the existing part numbers already entered into the database. How would you do this?

Obviously I could write some down-and-dirty code of many similar compare rungs that look at each part number separately, but I was hoping someone might have an elegant solution.

Thanks in advance,
Steve
 
take a look at the FAL and the FSC instructions ... depending on what you decide to do if the numbers DO match - or do NOT match - one of these might be helpful ...
 
A linear search is the the brute force way.

It will work if your data base isn't too big. I would try this first but.....

I would consider using a hash function to generate a hash code or index that is big enough to access your whole data base. I would round this up to a power of two.

A hash function takes the part number and converts it do a hash code or index. The index is then used to access the data base as if it is an array of UDTs.

The trick is to get the right hash function that will generate unique codes or indexes. I usually use an XOR function to generate the hash code.
 
Thanks, guys. Fortunately I have a pretty small list of numbers (less than 50) and each number is only 6 digits long.

Let me take a look at the FAL and FSC instructions and I will get back to let everyone know what I come up with.

Steve
 

Similar Topics

is it just me, or has something happened with the google search when using chrome? looks likes safari on mac is ok, but edge/chrome on windoze has...
Replies
10
Views
843
Besides using BootP in the past, I am relatively new to having to look for privately addressed devices in many control networks. All of the...
Replies
23
Views
3,997
Good morning, could anyone recommend a 24VDC pulse counter which counts up or down to a preset #? Once it reaches this number, send a 24VDC back...
Replies
3
Views
1,655
Hi, Using FactoryTalk View SE version 9.0. Wondering if someone can help me as to whether or not I can search an entire display for instances of a...
Replies
3
Views
2,312
Is there any way to stop a search from finding a text string inside a sub-tag name. For example: if I'm searching for "run" ... I only want to...
Replies
10
Views
2,127
Back
Top Bottom