2012-08-07 12:19 UTC
I have a csv file, from which I add values in my comboboxes. In the lisp file, I use a function to parse the csv file in a list of lists. Each list contains all the strings from a line (ex. in the csv file the line is: "1026,1017,9,Alba Iulia,1" and after parsing the file will result a list like this '("1026" "1017" "9" "Alba Iulia" "1"). In the end will result a list like this '( (list1) (list2) (list3)...(listn) where n is the maximum number of lines from the csv file.
So, for example if I want to use the value "1017" from that list, the variable will be like this: (setq var (cadr (nth posf lst))), where lst is the list with all the lists, and posf is the position of the list in the big list.
In my odcl file I have 2 forms: Form1 and Form2. In Form1 I have ComboBox4, ComboBox5 and ComboBox6 (the ones from upleft).
ComboBox4 has a predefined list and an OnSelChanged event. In the csv file, the last value from each line (in this case "1") has the value of (1+ ItemIndexOrCount from that OnSelChanged event.) So, when you select ALBA, for instance, which has the value of ItemIndexOrCount of 0, in the csv file it will have the value "1", when you select ARAD which has the value of ItemIndexOrCount of 1, in the csv file will have the value "2" etc. The last value from each line is stored in a variable called jn2.
The second value from each line in the csv file is stored in a variable called sirsup. So, when I select a value from ComboBox4, I read the csv file and if (1+ ItemIndexOrCount) is equal with jn2, and if sirsup has less than 4 letters, the fourth value from each line in the csv file is added in ComboBox5 and is stored in a variable called string1.
For example, when i select ALBA in ComboBox4, the ComboBox 5 will have the values: "Mun Alba Iulia|Mun.Blaj|Mun. Aiud etc."
The first value from each line in the csv value is stored in a variable called siruta. You can observe that in the next line sirsup has more than three letters and is identical with siruta from the previous line.
What I want is:
-when I select a value from ComboBox5, I want ComboBox6 to be filled only with the variables string1 from that lines in the csv file which have sirsup value identical with siruta value of the string from ComboBox5.
So, I give an example to be understood:
-In ComboBox4 I select ALBA (which is the first value).
-In ComboBox5 I select Mun. Alba Iulia
-So, I want in ComboBox6 to appear the following values: "Alba Iulia|Barabant|Micesti|Oarda|Paclisa" and then stop because the next line has a string1 which was added in ComboBox5.
I attach here the csv file, the lisp file and the odcl file. I mention that the comments from the lisp file and the forms interface are in romanian language. The lisp file is not complete, but is working.
I apologise for my poor english and I hope my post will be understood.
So, for example if I want to use the value "1017" from that list, the variable will be like this: (setq var (cadr (nth posf lst))), where lst is the list with all the lists, and posf is the position of the list in the big list.
In my odcl file I have 2 forms: Form1 and Form2. In Form1 I have ComboBox4, ComboBox5 and ComboBox6 (the ones from upleft).
ComboBox4 has a predefined list and an OnSelChanged event. In the csv file, the last value from each line (in this case "1") has the value of (1+ ItemIndexOrCount from that OnSelChanged event.) So, when you select ALBA, for instance, which has the value of ItemIndexOrCount of 0, in the csv file it will have the value "1", when you select ARAD which has the value of ItemIndexOrCount of 1, in the csv file will have the value "2" etc. The last value from each line is stored in a variable called jn2.
The second value from each line in the csv file is stored in a variable called sirsup. So, when I select a value from ComboBox4, I read the csv file and if (1+ ItemIndexOrCount) is equal with jn2, and if sirsup has less than 4 letters, the fourth value from each line in the csv file is added in ComboBox5 and is stored in a variable called string1.
For example, when i select ALBA in ComboBox4, the ComboBox 5 will have the values: "Mun Alba Iulia|Mun.Blaj|Mun. Aiud etc."
The first value from each line in the csv value is stored in a variable called siruta. You can observe that in the next line sirsup has more than three letters and is identical with siruta from the previous line.
What I want is:
-when I select a value from ComboBox5, I want ComboBox6 to be filled only with the variables string1 from that lines in the csv file which have sirsup value identical with siruta value of the string from ComboBox5.
So, I give an example to be understood:
-In ComboBox4 I select ALBA (which is the first value).
-In ComboBox5 I select Mun. Alba Iulia
-So, I want in ComboBox6 to appear the following values: "Alba Iulia|Barabant|Micesti|Oarda|Paclisa" and then stop because the next line has a string1 which was added in ComboBox5.
I attach here the csv file, the lisp file and the odcl file. I mention that the comments from the lisp file and the forms interface are in romanian language. The lisp file is not complete, but is working.
I apologise for my poor english and I hope my post will be understood.