Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Array
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Array

 Post Reply Post Reply Page  123>
Author
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Topic: Array
    Posted: 05 November 2004 at 3:30pm

Back again.

Ive never used arrays, and dont really understand them too much.  But i think i need to use them,

Scenario is.... got my post codes database, can now enter a postcode and it will throw up all the postcodes within a given mileage.  I need to collect these postcodes and then use them in the search criteria in another table (Find all records where the postcode is "one of these").

Anyone offer any help?  I dont know how to do it.

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 05 November 2004 at 4:30pm
Well first load all your give postcodes into an array like
array = recordset.GetRows( Rows, Start, Fields )
Now I don't know how you query so I give you the more complex form, you may be able to streamline it further if your query is simpler.
Dim i as integer = 0
For i=0 to ubound(array)
'Query here with the postcode like
Select whatever from yourtable where postcode='" & array(i) & "'"
Next

This method can like I said be streamlined to only do one database call instead of i calls
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2004 at 9:35am
If you join postcodes table with the othe rtable you won't need the array.
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2004 at 9:38am

how come?  I would need to calculate the distance the user selects and run a search for all that are nearby surely?

Please tell me theres another way because it takes ages to process the page

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2004 at 11:00am
well ljamal is partly right, depending on the formula you can do it in sql server or even access, all depends on how complex your forumla is. Generally asp has more calculation options then either database. So if you show the forumla on how you process it we can tell you if it's possible in either db system.
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2004 at 12:10pm

Sounds good, so here goes. Its quite easy really...

x1 is the longitude value for the FROM post code
y1 is the latitude value for the FROM post code
x2 is the longitude value for the TO post code
y2 is the latitude value for the TO post code

Now, all I do is calculate the differences and stuff, like this....
xdif = 69.1 * (y2 - y1)
ydif = 69.1 * (x2 - x1) * cos(y1/57.3)

Where cos is the cosine function on the value in the brackets.

Then multiply x by itself and y by itself.  Add the 2 values together and calculate the square root!
miles=SQR(xdif *xdif +ydif *ydif )

Simple! Thumbs Up

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2004 at 6:35pm
What database? Access or SQL?
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 07 November 2004 at 7:17am

appologies, its Access. Should have said.

Ta

Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.