Compare multiple variables in a DRr? (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


susan@bennettme.com -> Compare multiple variables in a DRr? (1/3/2002 10:43:41)

I have created a database results region that allows a visitor to enter their zip code and view demographic information about that zip code. http://www.carnegiecomm.com/sms/zipcode.asp

I have now been asked if I can set this up so that a visitor could enter in up to three different zip codes and then have the table compare the demographic data on each side by side. Is this possible with FP2000 and Access?

Susan Jordan Bennett
www.shoestringshipyard.com




Spooky -> RE: Compare multiple variables in a DRr? (1/4/2002 0:35:47)

If you presented the user with a multiple selection box containing zips, you could then use a query "WHERE ZIP IN (::input::)"

"input" from a multiple list will look like : 123,122,124,132 etc... and assumes "zip" is numeric

and then use formatting to display seperated information to the user.

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/8/2002 17:46:15)

Spooky, I'm just getting back to this question. Thanks for your response. Here's my dilema. There are 30,000 plus zip codes in the country. I don't think a multiple selection box is an option... even if I break it down by state. I may however be able to do this by county. Is it possible, in the search form, to have visitors click on a state from a drop down box and then have a list of appropriate counties come up? I know this can be done with java script, but I don't know if I can incorporate this idea into the database results set-up. Any thoughts?

Susan Jordan Bennett
www.shoestringshipyard.com




Spooky -> RE: Compare multiple variables in a DRr? (1/8/2002 20:39:32)

Hmm - see your problem.
Not really anything I can think of, unless you post from page to page.

Maybe supply a "Enter how many zips" box and generate a form with x boxes.
All of this would be asp though... :(

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/9/2002 9:27:44)

Spooky, what if I posted page to page and the first page contained three text boxes in which the respondent typed in their zips. Could I then pass these on in some fashion to accomplish what you suggested earlier?

"If you presented the user with a multiple selection box containing zips, you could then use a query "WHERE ZIP IN (::input::)"
"input" from a multiple list will look like : 123,122,124,132 etc... and assumes "zip" is numeric"

Or am I mixing up possible solutions?

Susan Jordan Bennett
www.shoestringshipyard.com




Spooky -> RE: Compare multiple variables in a DRr? (1/9/2002 20:16:32)

Not really, the problem lays in getting the correct input at the end (with commas in the right place)
Its another one of theose things, where if you need to thing outside of the box, asp comes in handy :(

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




d00nson -> RE: Compare multiple variables in a DRr? (1/10/2002 8:35:52)

Hi Susan, Spooky! Just throwing in my 2cents worth. I was just reading Susan's 1st post, since she wanted to enter up to 3 zip codes and display all 3 side by side, can't she just have 3 text boxes in the same form, call the boxes "zip1, zip2, zip3" then submit to a page with a DRW and query with "SELECT * FROM table WHERE (zipcode=::zip1::) OR (zipcode=::zip2::) OR (zipcode=::zip3::) then put the DRW on a diet and hack it to display the data in 3 columns? This would give the compare side by side part that Susan wants.

To solve the problem of if she wants to group the zips by country/county etc. and let the customer pick them instead of manually input prior to submitting to the comparison page, I would have 3 DRWs in a table with 3 columns, each column would be identical except for the last box in each column which would be the (zip1, zip2, zip3) I mentioned earlier containing the zipcode to be submitted. Then have multiple dropboxes in each column to progressively filter the results to produce the grouped zip codes.

Hope this doesn't confuse matters more





Spooky -> RE: Compare multiple variables in a DRr? (1/10/2002 12:03:04)

If desperation set in, then yes, thats the next option.
I think the problem lays in that the user may want to enter 1 or 20 codes?

Thats where, although you can use the DRW, you need to hack it to remove any unfilled text boxes.

So, its not pretty, but can be done that way.

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/14/2002 14:40:26)

Thank you both for your feedback. I'm still working on this task! Since I've got a learning curve here I simplified the issue by trying to compare just two zip codes. I used d00nson's suggestion and came up with the following.

http://www.carnegiecomm.com/sms/test/ziptest.asp

Now I need to figure out how to "hack" the table so that the results will display side by side with the data from each zip code for each variable side by side? Any advice?




Spooky -> RE: Compare multiple variables in a DRr? (1/15/2002 1:34:47)

Its perhaps a similar hack to :
www.outfront.net/spooky/advanced.htm#Formatting

what you are doing, is adding a <td> ( a new column) when each record finishes.
Definite diet material :)

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




d00nson -> RE: Compare multiple variables in a DRr? (1/15/2002 4:33:28)

Hi Susan! Yes..it's looking good All you have to do now is follow Spooky's instructions to remove the grey code (save the include files) and you can actually copy the format output in rows as is, since you are only returning 2 records, the other two columns will not take up space. But when the time comes to show more zip codes side by side, you won't have to edit the code again to show up to 4!

 




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/15/2002 20:11:47)

Well, I'm still at it. Spooky, I was able to recreate your side by side records when including only one variable from the database. However, when I add a second variable as follows:
<%If x = 0 then %>
<tr>
<%end if%>
<%x=x+1%>
<td><%=FP_FieldVal(fp_rs,"Zip")%>
<td><%=FP_FieldVal(fp_rs,"PO")%>
<% If x < 4 then %>
</td>
<%Else
x = 0%>
</tr>
<%end if%>

I get this: http://www.carnegiecomm.com/SMS/Test/zip1.asp

I played with it a bit thinking that if I could get the code for the variables in columns it would generate the records side by side, but what I ended up with is all the variables for each record displaying vertically. This is the codee I used:
<%If x = 0 then %>
<tr>
<%end if%>
<%x=x+1%>
<tr><td><%=FP_FieldVal(fp_rs,"Zip")%></td></tr>
<tr><td><%=FP_FieldVal(fp_rs,"PO")%></td></tr>
<% If x < 4 then %>
<%Else
x = 0%>
<%end if%>

THis is what I ended up with: http://www.carnegiecomm.com/SMS/Test/zip2.asp

Any advice for rewriting my code to have my zip code records running accross the columns and my variables running down the rows? Thanks!

Susan

Susan Jordan Bennett
www.shoestringshipyard.com




d00nson -> RE: Compare multiple variables in a DRr? (1/16/2002 10:28:18)

Susan, I had the same trouble with this piece of code when I first started. I have to admit that I am still having some trouble placing the extra loop code myself. But basically, what you are trying to do is for x=number of columns you want to display, if x is not equal to that number yet, keep dumping selected fields for that state from the DRW until you find x=0 (which should be at the end of the last field dumped) now increment x by one to show that we have completed one state, now start a new column and dump another State's data in a new column and repeat until you reach the magic number. 4 in this case.

d00nson
Same difference




d00nson -> RE: Compare multiple variables in a DRr? (1/16/2002 10:43:54)

What you can try to do if it is too confusing with all those <td> and <tr> tag pairs is to create a DRW with just a single output (field) then switch to HTML field. Things should look alot simpler now. Take note of where Spooky has inserted the extra code and his references to the grey code that you will be removing when the DRW goes on a diet. Once everything looks sweet, diet the code switch back to Normal view, now you can imbed a table into the single cell holding the one value from your DRW (obviously the table would be in the format you prefer to have your data displayed, say - 2 columns by 5 rows so you can display the field names in the left column and the actual data fields in the right. The 5 rows would hold 5 field values...adjust to your needs) Now the code will loop through and include this new embedded table. Since the code is on a diet, you should now be able to see the icon which is holding the code snippet for the field value <%=FP_FieldVal(fp_rs,"fieldname")%>. Copy and paste it into the other cells in your embedded table and switch back to HTML mode to rename the extra fieldname to corresponding fields you want to output such a Statename, zip, whatever. Long winded but fool proof (for me at least) hope this helps

d00nson
Same difference




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/16/2002 11:15:06)

d00nson, thanks so much for the new thoughts. I'll keep working with it!





d00nson -> RE: Compare multiple variables in a DRr? (1/16/2002 11:28:12)

Susan, I just hope I haven't led u astray! Spooky is the grand master for these things [;)}

d00nson
Same difference




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/16/2002 11:51:43)

You have NOT led me astray. I'm getting there. Check this out...
http://www.carnegiecomm.com/sms/test/zip4.asp

Now I just need to fine tune... What I need to figure out now is if I can have only one column of field descriptions rather than one for each zip code presented. Thanks so much for your advice!

Susan




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/16/2002 13:53:35)

Actually, the URL has changed...
http://www.carnegiecomm.com/sms/test/zipcode.asp

Any thoughts about how to have only one colum of headers show?

Susan




Spooky -> RE: Compare multiple variables in a DRr? (1/16/2002 14:32:24)

What zip code can I use ?

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/16/2002 14:37:22)

Spooky, try yours. Any zip code in the US SHOULD work.
Susan




d00nson -> RE: Compare multiple variables in a DRr? (1/17/2002 3:23:23)

Heheh...check Spooky's location. I had the same problem because I have no clue about US zip codes. 20001, 20003 and 20007 works for me thought. Suggestion, make the cells "nowrap" since I noticed that some of the fields and wrapping to a second line and they are losing row alignment with the field name. Is it because you are using a separate table and manually typing the values in? It's a bandaid solution, but works fine as long as the fieldnames stay constant or the order of the data doesn't change.

d00nson
Same difference




susan@bennettme.com -> RE: Compare multiple variables in a DRr? (1/17/2002 9:41:34)

Geez. It's a big world out there! Thank you both so much for your help on this. I've learned a lot through this process. I'm pretty much at the point where I'm fine tuning. For the timebeing the latest version resides at:
http://www.carnegiecomm.com/sms/test/zipcode1.asp




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.140625