03-03-2021 03:00 PM
Hello,
I am trying to figure out how to delete an element of an array using only the array reference. This is a 1D array that won't have very many elements, but the elements can be of any type (numeric, string, cluster, etc.). I can successfully add elements to the array, but cannot figure out how to implement delete. Currently, I'm changing the "deleted element" value to 0 (or equivalent) and moving it to the end of the array. This isn't sufficient as I need the initialized size of the array to decrease when I delete an element. I've attached an image demonstrating the results I want.
The Delete From Array Function won't work because I only have access to the array reference. To my knowledge, I can only use Invoke Nodes and Property Nodes. I tried seeing if I could disable a singular element, but the disable and enable properties affect all array elements. I've also tried passing in a blank variant constant to the Value property of the control reference, but this didn't work. I've attached an image of this attempt and the resulting error message.
I have also attached an image of how I am successfully adding an element to the array.
Any ideas would be greatly appreciated!
Solved! Go to Solution.
03-03-2021 03:25 PM
You can read the "value" property, use "delete from array", then write the "value" property. This is quite slow relative to using the terminals, but if you're not doing it frequently it should work fine.
03-03-2021 04:46 PM
Gregory,
This worked perfectly - thank you!
Picture of solution attached if anyone is interested.