BJG
April 25th, 2003, 03:06 PM
Hello. I need some help from you guys in creating a 2-way analysis report with VB.NET. I am working with a flat file (with fixed fields) and need to create an analysis on 2 different fields. Below is a file example to better explain my problem.
FILE EXAMPLE:
Fields:
positions (1-10) = TYPE
positions (11-20) = FRUIT
positions (21-25) = ANIMAL
ABC123 apple dog
ABC124 peach cat
ABC125 grape horse
ABC125 peach dog
.....................................
I want to run an analysis on the fields TYPE by ANIMAL (and ignor FRUIT). and get the following results.
cat dog horse TOTAL
ABC123 0 1 0 1
ABC124 1 0 0 1
ABC125 0 1 1 2
TOTAL 1 2 1 4
Once I have these results I need to import them into Excel usingthe .COM reference which I know how to if I am only importing on on field. But If i am importing on 2 fields like this how do I keep it staight on what corresponds with what,and keep everything in the correct order?
I am thinking that the best way do to this would be to use a hashtable, which I have uses before many time. But I dont know how to do this with multiple fields. I know this was a little confusing, so if you need me to explain anything a little bit clearer just ask. Any help would be greatly appredciated.
Thanks,
Brian.
FILE EXAMPLE:
Fields:
positions (1-10) = TYPE
positions (11-20) = FRUIT
positions (21-25) = ANIMAL
ABC123 apple dog
ABC124 peach cat
ABC125 grape horse
ABC125 peach dog
.....................................
I want to run an analysis on the fields TYPE by ANIMAL (and ignor FRUIT). and get the following results.
cat dog horse TOTAL
ABC123 0 1 0 1
ABC124 1 0 0 1
ABC125 0 1 1 2
TOTAL 1 2 1 4
Once I have these results I need to import them into Excel usingthe .COM reference which I know how to if I am only importing on on field. But If i am importing on 2 fields like this how do I keep it staight on what corresponds with what,and keep everything in the correct order?
I am thinking that the best way do to this would be to use a hashtable, which I have uses before many time. But I dont know how to do this with multiple fields. I know this was a little confusing, so if you need me to explain anything a little bit clearer just ask. Any help would be greatly appredciated.
Thanks,
Brian.