05-24-2022 05:10 AM
Hello, I am looking for advice on how to create a system by using a table as a control. I made a VI that starts from a value of zero and increments up to a maximum value in a user-defined steps, then decrements back to zero.
I need to create a similar system that uses a table to hold its inputs. Basically there are 3 columns: column 1 holds a value from which to start incrementing, column 2 holds the goal value and column 3 holds the time in which the goal value must be reached.
I have attached my VI as well as screenshots of the system I want to recreate. Can anyone give me input on where I can start and how I can make the table-controlled system?
Solved! Go to Solution.
05-24-2022 05:20 AM
05-24-2022 10:39 AM - edited 05-24-2022 10:41 AM
A table is just a 2D array of strings cosmetically suitable to preset to the user. You are dealing with numeric entries and I assume all the user does is select one of the rows (i.e. NOT modifying any of the values directly). As has been suggested, a multicolumn listbox is all you need. Keep the data in a numeric 2D array and use the listbox (in a listbox, the selected row is the "value!) to undex into your 2D array to get the relevant values for the run. (you can trigger just by selecting or you could trigger when a row is double-clicked, for example. The possibilities are endless.
Your snippet deals with one row, I assume, so none of the orange values are supposed to change during the run and their terminals belong before the loop.
I have the nagging feeling that your "boolean gymnastics" could be dramatically simplified. Have you tried? 😄 (There is also a primitive for <=0). Shouldn't that shift register be initialized?
05-24-2022 11:11 AM
@altenbach wrote:
I have the nagging feeling that your "boolean gymnastics" could be dramatically simplified.
I think this is equivalent (but much easier to read and debug!)
Or even:
Please verify correct operation and tweak as needed. 😄
05-25-2022 04:39 AM
Thanks for the tip. I read up everything I could on multicolumn listboxes, but could not figure out one thing - can I use individual cells as controls? Or is the listbox only for displaying data?
05-25-2022 04:41 AM
Thanks for the tip altenbach, it is indeed easier to debug with your solution. Do you happen to also know if I can use a multicolumn listbox as a control? What I want to do is use each individual cell in the listbox as an input for a calculation.
05-25-2022 05:10 AM
Hi Hobo,
@InfamousHobo wrote:
Do you happen to also know if I can use a multicolumn listbox as a control? What I want to do is use each individual cell in the listbox as an input for a calculation.
You can use the MCLB as a control - but it's value is the row [number] selected by the user!
The "individual cells" are values you keep in a 2D array "in the background" (aka wire/shift register). THe user selects a row and you can use the row number to index your elements from that 2D array…
05-25-2022 08:45 AM
Thank you for the input. I don't quite understand what you mean though hahah. Could you please show me an example of your explanation?
05-25-2022 12:43 PM - edited 05-25-2022 12:43 PM