LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from INI file to application cluster

Solved!
Go to solution

Hi all, I'm new here.

I have a doubt where existing application cluster has a combo box which has only one value in it that is given as a constant. 

Now, I have to add another element to cluster box. Where I need to read it from INI file as a key which will be bundled to cluster ,so that same application runs when I select newly added element of combo box. Can anyone please help? 

0 Kudos
Message 1 of 8
(268 Views)

Hi spark,

 


@spark5 wrote:
Now, I have to add another element to cluster box. Where I need to read it from INI file as a key which will be bundled to cluster ,so that same application runs when I select newly added element of combo box. Can anyone please help? 

You need to change your VI to read one more key from your INI file...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(260 Views)

Hi, I have similar issue which I need to work upon. Can you please tell me how did you resolve in this case? 

0 Kudos
Message 3 of 8
(215 Views)

Yes, Thankyou for your reply.

Is it possible to add two elements under same key in INI file? If not, then how should I proceed.

0 Kudos
Message 4 of 8
(243 Views)
Solution
Accepted by topic author spark5

Well you could change your INI file read and write functions or replace it with the OpenG Variant Config functions.

 

And how would you suppose you could add multiple item to the same key? An INI file is more or less a key-value pair table and that requires unique keys in a single table [INI file section].

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 8
(242 Views)

@rolfk wrote:

Well you could change your INI file read and write functions or replace it with the OpenG Variant Config functions.

 

And how would you suppose you could add multiple item to the same key? An INI file is more or less a key-value pair table and that requires unique keys in a single table [INI file section].



Hi, Thankyou for your reply. 

I have a key name which is been read from combo box to run the application.

Now I'm adding new element to combo box which is supposed to read from same key and run the application. 

I'm not sure how to add it and read.

 

I'm sorry i have accepted solution by mistake. But my question still is active. 


 

0 Kudos
Message 6 of 8
(225 Views)

Hi spark,

 


@spark5 wrote:

I have a key name which is been read from combo box to run the application.

Now I'm adding new element to combo box which is supposed to read from same key and run the application.


Why do you need a new element in the combobox when you want to read from the same key???

 

Again: an INI file stores key-value pairs. You are responsible to read the needed keys in your program…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(207 Views)

@spark5 wrote:

I have a key name which is been read from combo box to run the application.

Now I'm adding new element to combo box which is supposed to read from same key and run the application. 

I'm not sure how to add it and read.


It would help a lot if you explained in more detail what you really want and maybe attach a simple example.

So far you were talking about a cluster that contained a combobox and that you wanted to save to and read from an INI file. I start to suspect that you are mixing up values of controls and attributes.

 

The current value of the combobox, which is a string, is its value, and can be simply stored under one key in the INI file. But what you seem to want to do is to also store the possible values of the combobox that the user can choose from. This is an attribute of the combobox. You should also think about if the user is allowed to add his own values. A combobox can have multiple preconfigured items to choose from, but the user is free to enter other values. If that is not desired you should use a ring control instead.

 

Both of them have a property node that returns the currently known selection values or lets you define them. It is an array of strings that you then have to save as such in the INI file. So in terms of saving these in the INI file you have to save it as array of strings and then read it back as such and explicitly assign it to the combobox/ring control through its "Items" property.

 

Usually the attributes of controls like that are usually stored in a different INI file or under a different section in the INI file than its values! You have to program that yourself explicitly but the aforementioned OpenG Variant Config library makes a lot of the nitty gritty work of reading and writing pretty much any type of data in an INI file almost a snap.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 8
(193 Views)