07-26-2024 02:24 AM
I am using a SQL query to populate a Text ring. I need both IDs in the digital disply, and the item names in the text field of the Ring. So far I have always used my functions and SQL query to populate the data in a multicolumn list box, but I don't know how to do it in a ring. The reason behind this choice is to give the user the oppotunity to use a dropdown menu to choose one of the items, or if they know the item ID, type the ID in the ditial disply, and the corresponding item would show up for further functions. Can someone help me please?
I have simplified my code in the screenshot below, but can't post the VI since it is sending query to my database. There is also a screenshot of the variant to multicolumn list box subVI that I am using.
Solved! Go to Solution.
07-26-2024 02:32 AM
Create a 'StringsAndValues[]' property node for the ring control. The data type is an 1D array of cluster of 'string' and 'value' pairs.
07-26-2024 02:44 AM
Only a further minor note: the sequence structure in the subvi is useless.
07-26-2024 02:59 AM
@pincpanter wrote:
Only a further minor note: the sequence structure in the subvi is useless.
It's not just the sequence structure, this basically does the same.
07-26-2024 03:03 AM
@UliB my problem is, I don't know how to use the output of my SQL query, which is recordset data, to populate it. At the moment, as I mentioned, I get a multicolumn listbox reference, but that is obviously not compatible with a ring property node of strings and values.
p.s. I know my current structure is useless and may not make much sense, but I have only created a simplified version of my complicated code for the sake of my question. Thanks in advance for all the useful tips.
07-26-2024 03:09 AM
Hi Seli,
@LZD_Sydney wrote:
my problem is, I don't know how to use the output of my SQL query, which is recordset data, to populate it. At the moment, as I mentioned, I get a multicolumn listbox reference, but that is obviously not compatible with a ring property node of strings and values.
Your MCLB gets a 2D array of items, a ring needs a 1D array of strings:
07-26-2024 03:10 AM
Set up your query to output strings and values and feed the same data type to Database Variant to Data
07-26-2024 03:26 AM
@RamonG I just did, and it gives me Error 1129! I also tried with DISTINCT.
07-26-2024 03:29 AM
Hi @GerdW.
Thanks for the step by step guidance. There is only 1 problem: The IDs are not necessarily sequentially all the numbers, there maybe one or two missing (example 1, 2, 3, 5, 7, 8, 9...). Therefore, I can't just use auto indexing, but I actually need to get column 1 as index and column 2 as text/item name.
07-26-2024 03:29 AM
The order inside your query must be the same as in the cluster constant.
Try: SELECT Name, ID FROM Unitclass