cancel
Showing results for 
Search instead for 
Did you mean: 

Radius Calculation

Former Member
0 Kudos

Hi

I have a table containing postcodes and their X and Y coordinate location. I am trying to run a query whereby I select one postcode which then selects all the postcodes that lie within a selected radius of this point. However anything I try seems to keep leading me up a blind alley. Does anyone know if this type of query is possible in Crystal Reports?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The theory:

to see whether a point lies within a circle, find its distance from the centre.......if its less than the radius...then it falls inside....

distance = sqrt((x2-x1)2 + (y2-y1)2)

Former Member
0 Kudos

The problem I have is using this equation as a selection formula. If I select a postcode I need to somehow use it's postcode X and Y coordinates in the query to select the relevant postcodes. I'm quite new to Crystal Reports and I keep getting stumped that when I do something that is evaluated in the second pass I can't use that in a selection formula which I think is calculated in the first pass. Is this right?

Former Member
0 Kudos

....forget that...thinking out aloud!

Edited by: Dom Horton on Oct 13, 2008 1:55 PM

Former Member
0 Kudos

Yes, that's correct.

You're picking it up quickly.

I suggest you look at:

-adding sub sections to sections (Group Footer 1, Group Footer 1a, etc)

-shared variables

-WhilePrintingRecords

-BeforePringtingRecords

-EvaluateAfter

Place whatever formula you have in a section and actually see when it is evaluated.

This will tell you it's ok to place the next formula in the same section or one below it.

This is tricky, so it takes a little experimentation and patience.

Hope this helps,

The Panda

Answers (1)

Answers (1)

Former Member
0 Kudos

You need a GIS system!

What backend database are you using?

I'm aware some of them support spatial queries.

Regards,

Dom

Former Member
0 Kudos

This is what I was thinking. I use ArcGIS 9.2 but as I'm setting this up for other people to use I was wondering whether I could use the coordinates to set up a simple query using trigonometry to select the relevant postcodes.