LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use array to search array and pull indices

I've run into a wall. I'm trying to use the array with the Technician names that were searched and duplicates removed. I want to use these Names and search the Pass/Fail array and count up each Technician's Pass/Fails and display them appropriately next to their names. Co-worker tried explaining OpenG, said it would be easier. Not quite sure how to set up this step. I've got the idea in my head, just can't seem to put it out on the Block Diagram. Still new to Labview and understanding what it can do.

 

So It will be something like the below example:

 

Techname          Pass             Fails

Joe                          5                   2

Mary                      15                  0

Susan                    12                  8

....

etc.

 

 

Download All
0 Kudos
Message 1 of 7
(3,439 Views)

Variant Attributes would be useful here.  No need to even sort the names since the variant attributes does it all for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,414 Views)

You haven't specified where the information is stored (If it says so in the VI file, I apologize since i can't view 2015 files).  If it comes from a relational database (SQL, mySQL, etc), my suggestion would be to normalize your database further so that the username is associated with an ID# rather than a string.  Numbers are easier to work with.  Same goes with Pass/Fail.  Save that as a bit rather than a string.  Then your solution become much less CPU intensive and can even be done by the SQL engine itself. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 7
(3,395 Views)

Wow, I didn't know variants can do so much. I've got another task assigned to me with the same VI. I need to add a Quantity Received per tech.

 

I tried adding a case statement (pictured below) into the first for loop that searches an auto indexed array of tech names and against itself to count each tech and how many they received, then added that number to the variant data from the Add into another Add and back into the set variant attribute value. What am I missing? I may be doing it completely wrong, I've never really worked with Variants before. 

 

Would I have to initialize the value elsewhere? Or can I add it to the Pass/Fail cluster? 

 

Attached both peices of Info. VI and Data for Received. I may be overthinking this code.

Qty Received.PNG

Download All
0 Kudos
Message 4 of 7
(3,351 Views)

Add another value to the data cluster.  Add another loop immediately after the first FOR loop and and update the Units Recieved using the Variant Attributes.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,340 Views)

What am I doing wrong? Added QTY received on 2nd loop and errors out when running with "Data type of variant is not compatible." I can see why, but when I add a 3rd to the original cluster, the output wire errors out and isn't compatible with the boolean sink for addition (2 cluster/3 cluster). The information I need is from a different txt file. Will that cause a problem? 

 

 

Qty Received (2).PNG

0 Kudos
Message 6 of 7
(3,298 Views)

All of your data clusters need to be the same.  They should all have the Passed, Failed, and Qty Recieved in them.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,286 Views)