05-12-2022 04:30 AM
On the table, I have 4 groups (relay 1,2,3,4...20), but I am only using 4 groups initially as you can see on the front panel when the vi is running (see attached VI). Each group has 3 columns (cycle, coil temp, stick time). Also I have empty group spots (from relay 5 to 20).
My goal is to be able to move any of my initial groups (relay 1 to 4) in any empty spot using controls I have on the front panel (p1,p2,p3,p4). I am able to do that successfully.
The problem I have is when I try to move another group. Then the group that I moved previously would switch spot. I do not want them to change spots. How do I prevent this from happening? or How do I fix this?
I just can't figure how to fix this.
On the front panel, try changing p1 to 7. Then after changing p1 to 7, change p2 to 10. Do this while the VI is running. You'll see exactly what I am talking about.
P.S: If you have a better way to do what I am trying to do, please feel free to share.
sharing with snippet or code is better.
Solved! Go to Solution.
05-12-2022 07:53 AM - edited 05-12-2022 08:03 AM
I think you shouldn't use Insert Into Array, but Replace Array Subset.
Insert Into Array is subject to the order in which you do this... If you insert at 7 first, then 10 is different then 10 first then 7.
Insert xx xx xx at 7:
00 01 02 03 04 05 06 xx xx xx 07 08 09 10 11 12 ...
Insert yy yy yy at 10:
00 01 02 03 04 05 06 xx xx xx yy yy yy 07 08 09 10 11 12 ...
Versus
Insert yy yy yy at 10
00 01 02 03 04 05 06 07 08 09 yy yy yy 10 11 12 ...
Insert xx xx xx at 7
00 01 02 03 04 05 06 xx xx xx 07 08 09 xx xx xx 10 11 12 ...
Versus
Replace xx xx xx at 10
00 01 02 03 04 05 06 07 08 09 xx xx xx
Replace yy yy yy at 7
00 01 02 03 04 05 06 yy yy yy xx xx xx
Versus
Replace yy yy yy at 7
00 01 02 03 04 05 06 yy yy yy 10 11 12
Replace xx xx xx at 10
00 01 02 03 04 05 06 yy yy yy xx xx xx
05-12-2022 08:40 AM - edited 05-12-2022 08:42 AM
Thank you so much Proven Zealot. My problem is solved. Thanks for the amazing explanation.