ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flatten to XML does not save Item Names of ListBox to XML file.

Solved!
Go to solution

On my Front Panel, I have a ListBox Indicator that has Strings from which the User can select. Also the User can edit items in the ListBox to add new elements. After the user selects one and pushes my Save button, I use the Flatten to XML function to save the selection in an XML file. But Flatten to XML only saves the Value (index of the selected item(s)) to the XML file and not the ListBox Item Names. That is enough information to reconstruct which of the String data that the user selected.

 

In a ListBox where a User is selecting among a list of Strings, shouldn't the Flatten to XML function also store the String(s) that were selected?

 

 

0 Kudos
Message 1 of 25
(4,767 Views)

A listbox is a numeric control and that is all that the terminal returns. If you want the string, you would have to use the Item Names property with an Inex Array function.

Message 2 of 25
(4,759 Views)

I am talking about using Flatten to XML to record the selection that the User chose in the ListBox. The USer chose a Sting in the ListBox, not a numerical Numerical Index. The ListBox contains a List of Strings. Recording only the Numerical Index of the Selection is insufficient information. The Selected Text must also be recorded.

0 Kudos
Message 3 of 25
(4,756 Views)

I know what you are talking about but you don't seem to understand. The user is actually selecting a numeric - the control is that data type. There just is no association with a string except with the property node. Perhaps you want to use a combo box if you don't want to extract the string from the property node.

Message 4 of 25
(4,750 Views)

@Dennis Knutson wrote:

I know what you are talking about but you don't seem to understand. The user is actually selecting a numeric - the control is that data type. There just is no association with a string except with the property node. Perhaps you want to use a combo box if you don't want to extract the string from the property node.


The problem is not that  I " don't want to extract the string from the property node". The problem is that the Flatten to XML function never recorded the Strings in the first place. If I read the XML file back in, there are no String to extract. I would be very happy to extract the Strings if only the Flatten to XML had recorded them.

 

The point I am making is that the Flatten to XML should record enough info about the COntrol so that the state of the Control can be reconstructed for the XML data. In this case that is impossible.

 

0 Kudos
Message 5 of 25
(4,743 Views)

The control is a U32 which is no different than placing a regular numeric control on the front panel. The flatten to xml is only passed a numeric value in both cases. It can't record something that you do not pass to it. The state of the control is the numeric value and the state can be reconstructed with that numeric. If you want to reconstuct the strings (which are not states), use the property node.

Message 6 of 25
(4,741 Views)

@Dennis Knutson wrote:

The control is a U32 which is no different than placing a regular numeric control on the front panel. The flatten to xml is only passed a numeric value in both cases. It can't record something that you do not pass to it. The state of the control is the numeric value and the state can be reconstructed with that numeric. If you want to reconstuct the strings (which are not states), use the property node.


I disagree. A ListBox that contains Stings to select from is full of String information. Both I and the User entered those Strings into the ListBox. It is the only data in the Listbox that we see. It is the most important information in the ListBox. The Strings are present in the Item Names. The Flatten to XML does have access to the Item Names and can and should provide them. Neither I nor the User are interested in the Numeric Index of the Selected Items. That is useless information to us. Both of use are dealing with Strings. If the State of the ListBox control is to be reconstructed from the XML data provided by the Flatten to XML function, then the Strings (Item Names) in the Listbox must be provided in the XML data.

0 Kudos
Message 7 of 25
(4,734 Views)

No, with a listbox there is no direct access to the strings. You are cofusing it with an enum which does work that way. The numeric value is enough to set the selection. The strings are stored separately. Make a suggestion if you want to change the existing data type.

Message 8 of 25
(4,731 Views)

What is the Item Names in a ListBox if not an array of String items that are displayed in the ListBox from which the User can edit and select from?

 

How do I reconstruct a ListBox, including the selected item (String), including also the Item Names, from only the data supplied by the Flatten to XML function? It can not be done.

 

If the Flatten to XML function also provided the Item Names in the XML data, this would be possible.

0 Kudos
Message 9 of 25
(4,727 Views)

This is getting stupid. You are whining about functionality that simply does not exist. Whether it should or not is just irrelevant at this time. We are dealing with the existing data type. I already told you what you have to do to get the strings with a second flatten to xml. And I already told you what you should do if you want the data type changed.

Message 10 of 25
(4,723 Views)