-1

I have an application that will load a CSV file containing two columns. At program load I need to have the first column as items in a combo edit control. Once the user selects (or enters a value) I need to populate a label with the value from the second column. My thought was to use an in memory data set, FDMemTable which would be loaded at form create. Then once the user selects, or enters an item, I would run a query to pull the description. I've tried but have been unsuccessful with the simple loading of the combo edit.

Is this the best way to achieve the desired results, and is there samples similar to what I'm looking to do?

  • Your question has nothing to do with FireDAC, other than the fact you've decided to mention it in passing. If you want to import the CSV into an FDMemTable, do so. If you've *tried but been unsuccessful*, post what you've tried here in your post, along with a sample of the CSV file, and ask a specific question about the code you've posted. (A database of any sort for a two-column CSV is probably overkill, unless it's a large CSV. A simple `TDictionary` or `TStringList` (using the name and value pairs) might suffice, but you've failed to provide enough information in your question to know.) – Ken White Oct 24 '15 at 03:04

1 Answers1

1
  1. Read the file.
  2. Parse it into an array of name/value pairs.
  3. Populate the combo drop down list with the names.
  4. When the combo's selection is changed to a new index, read the value from the array using that index. Update the label.

Database tables and queries seem somewhat over the top for a single simple task like this.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • I did end up using a name/value pair by changing the export from Excel from CSV to the name/value pair which works. The reason for using FD is two fold. First is to become more proficient with in-memory and FD tables. The other is because this project is in its infancy and will be growing. – Larry Nov 05 '15 at 02:29