LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Cluster to 1D Array?

Solved!
Go to solution

Ok I really dont know why im having issues with this (maybe cuz it's friday but still) but i have an indicator on my FP that is a 1-D Array of 7 Clusters. Each of the Clusters Currently only contains 1 string indicator in it (eventually will have more in it so the cluster needs to remain). But all the logic will be sitting inside a case statment and when called i need the whole thing to display the last 7 pallet IDs pulled off a line (each pallet has a 4-digit ID number that is read in by barcode). The output i get from my Subvi is just a string indicator of the current pallet ID being pulled, how can i make it display the last 7 pallet IDs pulled and update each time the case statement is called? Feeling dumb today but here is what i tried.

 

Thank you

___________________________________________________________________
"I have not failed. I've just found 10000 ways that won't work." - Thomas A. Edison
0 Kudos
Message 1 of 11
(3,272 Views)

You really need to post the subVI if you'd like help since that is where you say you are having problems.

0 Kudos
Message 2 of 11
(3,255 Views)

Can you try providing a bit more code? You mentioned a case structure, but there isn't one in your screenshot. Where are you storing the list of IDs that have been pulled? Do you want to store them in a constantly-growing list and only retrieve the last 7, or do you want to maintain a list of only 7 and each time a new one is pulled, the oldest one is removed? In any case you need an array, a loop with a shift register and some more logic.

0 Kudos
Message 3 of 11
(3,254 Views)

you might be on to something with the shift registers, how would i configure that if i was to display the last 7 pallets pulled and just keep indexing through so the FP only shows the last 7. here is the actual code its going in.

___________________________________________________________________
"I have not failed. I've just found 10000 ways that won't work." - Thomas A. Edison
0 Kudos
Message 4 of 11
(3,248 Views)

Not the subvi that im having issues. that works fine its really just taking a sting indicator putting it in to a cluster then making that a 1-D array and having it update the last 7 calls to it on the FP.

Thoughts?

___________________________________________________________________
"I have not failed. I've just found 10000 ways that won't work." - Thomas A. Edison
0 Kudos
Message 5 of 11
(3,239 Views)

What exactly do you mean by "update the last 7 calls to the FP"?    How do you "call" a front panel?

0 Kudos
Message 6 of 11
(3,236 Views)

yea bad terminology on my part sorry but the array (of clusters of String) indicator on this FP attached needs to display the last 7 Pallet IDs pulled. the subVI sends out the pallet ID if it needs to be pulled and the other portions of the program already pull the pallet. This portion of the code now needs to display the last 7 pallet IDs pulled on the FP.

___________________________________________________________________
"I have not failed. I've just found 10000 ways that won't work." - Thomas A. Edison
0 Kudos
Message 7 of 11
(3,228 Views)

It's still not clear how this works. You have a blue "Check Pallet Status Machine" subVI, and the output is a string. I assume that string is the Pallet ID, but what exactly does it contain? On each looop iteration, is it: the last ID pulled? An empty string, unless it just pulled a pallet? Something else? How do you know when a pallet has been pulled, so you can add it to the list of recently-pulled pallets? Other than that, yes, you need a shift register, storing a 7-element array. When a new pallet is pulled, rotate the array by 1 place, and replace the first (or last, depending on direction of rotation) element with the new pallet id.

Message 8 of 11
(3,193 Views)
Solution
Accepted by topic author Da-Coder

I'm going to assume that pulling a pallet is somehow an event that occurs within your program.

 

For maintain a list like that, I would use a functional global variable or Action Engine.  Somewhere near the beginning of your program, you initialize the action engine subVI to store an empty array in the shift register.  Later, whenever your "pull pallet" event occurs, you connect that pallet ID to the action engine subVI.  The subVI will use build array to place the element at the end of the array that it stores in the shift register.  It will then check to see if it has more than 7 elements in the array, and if so, will delete the oldest element from the array then place that pack in the shift register.  When the subVI ends, it outputs the array that is in the shift register.

 

Message 9 of 11
(3,189 Views)
Solution
Accepted by topic author Da-Coder

Solved The Shift Registers and it being Friday are what really screwed me up thank you Nathand and RavensFan Kudos to both of you but i'll mark this one as the solution just for other future refrence as it will contain the solution in an image although RavenFans solution would have worked just a nicely we decieded to just keep incrementing the array only displaying the most up to date 7 results.

___________________________________________________________________
"I have not failed. I've just found 10000 ways that won't work." - Thomas A. Edison
0 Kudos
Message 10 of 11
(3,184 Views)