 |
| Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 22nd, 2004, 11:59 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
List/Menu Box Options From a Text File
Hi All,
I have a somewhat complicated question and i can't seem to find an answer to even after looking all over. Let me first explain what I
want to do, and a method which I found could establish my goal. The hard part is, how do I go about doing it?
I want to create an ASP page where users can run a varities of reports(Car, Boat,etc.), specific of that report(Japanese cars, American cars, etc.), and finally the detail of that specific (Honda, Toyota, etc.)
Now, I found a very efficient method to do this, and that is to create a text file with ALL these information in it. In this case, I have two separate files or Category as I call it,(file named "CAR.txt" and "BOAT.txt"). In each of these files, I have information specific to each of these category. For example, the CAR.txt file would look something like this:
1
Car
Select CarType, CarModel from Car
2
Japanese Cars
Where CarType like 'Japanese%'
American Cars
Where CarType like 'American%'
3
Honda
Order by Honda
Toyota
Order by Toyota
Once I have these information in a text file. I can separate these information into THREE separate List/Menu boxes in my ASP page. Here is what each list/menu boxes should have.
First box has this:
CAR
BOAT
Second box has this(if I select Car from the first box:
Japanese Cars
American Cars
Third box has this(if I select Japanese Cars):
Honda
Toyota
Here is the hard part, and it is where I need help on. How do I get the information from these text file, and put them into separate box accordingly? Also, as you can see, the Second box and Third box changes accordinly to what the users select. That is, if I select CAR in the first box, only "Japanese Cars" and "American Cars" will show up in the Second box. If I then select "Japanese Cars," then the third box will have "Honda" and "Toyota." If I select BOAT, only information of boats will show up. You get my point? I just DON'T know how to code this so my ASP page can do this. Please help!!!
THank you
Leon
|
|

April 22nd, 2004, 01:42 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Leon,
Ignoring the technical implications of this solution for the moment, isn't a database a much more efficient solution? They are designed for these kind of tasks and are much more manageable than text files.
It would allow you to fire queries like:
SELECT ID, Name FROM MyStuff WHERE Type = 'Car'
and later on, to populate the report:
SELECT ID, Name, Description FROM MyStuff WHERE Type = 'Car' AND Brand = 'Honda'
IMO, this is much easier than reading in the entire file every time you need to access some data.
Is a database an option for you? In terms of technical complexity, a querying a database is about as complex as working with text files.
I can guide you with both options, if needed, but IMO, a database is the recommended way to go.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: 36 by System Of A Down (Track 9 from the album: Steal This Album)
|
|

April 22nd, 2004, 03:03 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
List/Menu Box Options From a Text File
Hi Imar, thanks for your recommendation and for the quick reply. This is in response to the reply you made on the topic listed above. The reason I wanted to use text files is I have a total of 8 categories to choose from, and under each category, I have at least 10 specific reports, and at least 5 details of each report. As a result, I could end up with hundreds of different reports. Not just that, by using a different file for each category, I can easily populate each of the 3 text boxes based on the report users wants to get.
I understand your recommendation of using a database(that's what the query strings are for in the sample txt file i showed you in my posting). I understand how to use a database for query. My biggest challenge is how to populate the list/menu boxes based on what the users select. I DON'T know how to make them changes dynamically. Please help! Thank You. Leon
|
|

April 22nd, 2004, 03:46 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Leon,
Thank you for your personal message. Glad it's working now.
Would you mind to share your solution, for my curiosity and for future reference on this forum?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Nothing Else Matters by Metallica (Track 8 from the album: Metallica)
|
|

April 23rd, 2004, 11:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Don't mind to share! :-)
Here is a link to the solution i use: http://www.macromedia.com/support/dr...x.htm#jssource
It provides you with codes and instructions on how to create the list boxes. Once you have the list boxes, you can assign hidden values to query your database. Thanks again.
Leon
Quote:
quote:Originally posted by Imar
Hi Leon,
Thank you for your personal message. Glad it's working now.
Would you mind to share your solution, for my curiosity and for future reference on this forum?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Nothing Else Matters by Metallica (Track 8 from the album: Metallica)
|
|
|
 |