From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Arrays with Keys

Solved!
Go to solution

Hello All,

 

From the looks of things, I can't write arrays using the key functions to write to the ini file. Is this correct?  I ask because I would like to simplify the code for this default color setting VI (8 colors) that allows me to specify default colors in an executable.  It just seems excessive to call the read and write functions 8 times a piece.  Any ideas? 

 

 

Download All
0 Kudos
Message 1 of 4
(3,274 Views)

Just a thought--

 

When I want to deal with multiple key-value pairs that have some dependance I look for a section.  since each K-V has the same data type I would define the config file like: 

 

[colors]

SA=<int>

SB=<int>

...

and just convert the values from the read section vi to an array

 

Otherwise- XML has native arrays 

0 Kudos
Message 2 of 4
(3,266 Views)
Solution
Accepted by topic author jonvanjam
You can also simply use the Array to Spreadsheet String and the Spreadsheet String to Array to convert your array from/to a delimited string. Then you just need to write a single string value. Note that the length has to be less than 255, as this is a limitation of .ini files. I think that 255 is right.
Message 3 of 4
(3,262 Views)
Thanks, that really simplifies things
0 Kudos
Message 4 of 4
(3,225 Views)