LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trying to populate a combo box from an ini file

cannot get it to work with anything other than a comma for the regular expression.  I want the ini file to list the values "vertically" seperated using new lines(\n) or carriage returns(\r).  This will be much easier for the user to maintain, rather than scanning through one one line of text, seperated by commas).  It works fine if I use commas and use a comma in the VI, but if I do it vertically (as in the ...groupsv.ini file) and use either an r and or an n, no go

0 Kudos
Message 1 of 5
(3,129 Views)

The loop only executed once unless I put a comma in as the regular expression.  If I put a comma in there and pull in the groups.ini file, it works fine.  If I put a new line (\n) character or a carriage return (\r) character, it only executes once.  WHAT am I missing here???

0 Kudos
Message 2 of 5
(3,114 Views)

You have a fundamental problem in that the Configuration File handles each line.  Put an indicator on what comes out of the Get Key Value and it will be obvious.

 

But since you only have 1 entry in the ini file, why not just use a standard text file?  If you have other things to put in your config file, just put a reference to the text file for the combo data.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(3,111 Views)

crossrulz, thank you for the reply.  It's been two years since I've had any opportunity to work in LV at all and I'm rusty to say the least Smiley Mad  Can you elaborate more on the "use a standard text file" piece?  I've used ini files in the past and I thought I remembered how everything worked.  Turns out, when I used them in the past, they were laid out like:

Value 1: X

Value 2: Y

Value 3: Z

 

and so on.  Then I just referenced the file to pull in those variables.

 

Here, I'm basically just trying to create a 1-column lookup table I suppose, so that the user has an easilly editable list they can use to populate the combo box. 

 

What's my best solution here?  I'm not too proud on a Friday afternoon before a Saturday Tough Mudder and a Sunday 100-mile bike race to ask for some help 🙂

0 Kudos
Message 4 of 5
(3,102 Views)

A text file is as simple as it gets.  Basically remove everything that says "configuration file".  You you just have the actual text that you wanted.  Then use the Read Text File primitive to read the file.

 

So your file should look something like this:

1% HF
5% H2SO4
2% HCl
4% HCl
10% HCl
2% HNO3
10% HNO3
1% HCl + 1% HNO3 + 1% HF
-
2% HCl + 0.2% HF + 1000 Flux
2% HCl + 0.2% HF + 10000 Flux
10% HCl + 0.2% HF + 1000 Flux
10% HCl + 1% HF + 1000 Flux
10% HCl + 0.2% HF + 10000 Flux

 Notice there is nothing for a section or key.  That's because you don't need it.  Just read it directly.  This will also make it easier for your users who have to edit it since they don't have to try to keep the configuration formating.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(3,078 Views)