LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine which array element is being edited?

I need to be able to programatically determine the array element that has been edited.  The array is an array of cluster.  The cluster contains 2 menu ring controls.  I also need to be able to re-assign the strings of one of the menu rings in a given element of the array based on the selection of another menu ring in that same array element.

What I have so far is included.

Please help me cut to the chase.   Hunt and peck is killing me!!

Thanks
LV 8.6 on Windoze XP
0 Kudos
Message 1 of 12
(3,347 Views)
Hi Clueless,

I assume you have a event structure (if not get one).
Create a 'value change event' for the array, in that event you can get the old and the new array value, XOR those two, now you have an array with one (1) true value, that is the element edited.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 12
(3,337 Views)
Sorry, but your code makes absolutely no sense. Is this a toplevel VI? How are you running it? (don't use the "continuous run" button!)
 
You seem to read and write (in no particular order) from/to the "index vals" properties. Why? What are you trying to achieve? Since you don't know what occurs first, the result will be completely unpredictable. 😉
What is the purpose of SelStart[] and SelSize[]?
The "Model Number:Strings" property occurs in all cases, thus you only need one instance of it AFTER the case structure.
 
There is no before/after, thus there is no way to tell what got edited. You need a loop and an event structure or shift register to see what changed. (e.g. similar to what TonP already suggested. Personally I prefer "Not equal" instead of "XOR" for clarity, but it does ot really matter).
 
In any case, all array elements must contain the same strings in the menu ring. You can not select this on a "per element" basis. It is not possible to have different ring entries for different array elements.
 
Maybe you should tell us how the operator is supposed to use the VI and what you expect to happen. It might be easier to start from scratch. 🙂
0 Kudos
Message 3 of 12
(3,332 Views)
Sorry about the extraneous stuff like the selstart etc.  It's junk I was trying.  I shot off this plea for help last night after running down this dark alley for way too long.  And, yea, I was running in continuous run but had every intention to put it into a whle loop after I figured out how to addresss the clusters within an array.

Hey,  Is it possible to just use a code structure and matlab style code, as in 

val = arrayofclusters(index).mycluster.mymenuring; ???.

Anyway, here's what I'm trying to do.  I want to have a subpanel that allows the user to dynamically add "radars" to a list (up to 4).  I want the users to be able to edit the lists.  The radars have different options based on vendor so, .as the user selects vendor, a different set of choices is loaded into the modelNumber menuRing. 

I want to eventually merge this data with other test specific tata and eventually pass the array into a vi that runs testing on each radar that requires different api calls dependendent on vander and model.

The event loop does seem to be the way to go.  Can you suggest a simple example, and maybe a blow by blow of the clickinations?

Thanks
LV 8.6 on Windoze XP
0 Kudos
Message 4 of 12
(3,304 Views)
Ok

I looked at the event loop structure, and found the change event case.  Well, I can get newVal, oldVal, and a reference to the array, but I still don't see how to get the array element number that the change took place in.  What am I missing?
LV 8.6 on Windoze XP
0 Kudos
Message 5 of 12
(3,300 Views)
Here's a quick example. Makes sense? 🙂
0 Kudos
Message 6 of 12
(3,293 Views)
OK, Here's what I've got so far.  I can do everything except address  "modelNumber" rings for a particular array element.  Is this because all of the ModelNumber rings have to be the same?

Thanks


LV 8.6 on Windoze XP
0 Kudos
Message 7 of 12
(3,286 Views)

I don't have time at the moment to look into this, but:

  • an event structure always belongs in a while loop.
  • if you exclusively use "index array" with the index wired to the [i] terminal, you can .
    • eliminate wiring N to the array size
    • use autoindexing tunnels for the arrays
    • eliminate all "index array" operations.
    • (see image)
  • You can resize "unbundle by name" to only show the actually used terminals.

Yes, all model number rings need to be the same in an array.

Message Edited by altenbach on 02-27-2007 10:18 AM

0 Kudos
Message 8 of 12
(3,277 Views)
Hi,
 
You need to get reference to the “ModelNumber” ring control within the array of cluster in order to access the "String[]" property node.  Any change to the “ModelNumber” will reflect on all the elements in the array.
 
Checkout the modified version of your VI.
 
Tunde
0 Kudos
Message 9 of 12
(3,267 Views)
Hey Guys

Thanks a bunch. 

This is all very good stuff.  I only have one remaining question.  It's a matter of clickery.  I found the "to more specific" thing.  What do I click to get the cluster and ring typedef things?

Thanks

LV 8.6 on Windoze XP
0 Kudos
Message 10 of 12
(3,260 Views)