85
Views
5
Comments
Find distance using aggregate
Question

Hi all,

     I know that we can calculate the distance using SQL in outsystems.

     But is there a way to calculate the distance using aggregate in outsystems?


Regards, 

Gowtham

2019-09-24 18-41-25
Jorge Martins
 
MVP

Hi Gowtham,

What do you mean by "distance" here? and how do you calculate it using SQL?

2023-10-30 06-03-17
Gowtham

Hi Jorge,

     Thanks for your reply.

     Consider the following

     I am having two attributes in my user table as latitude and longitude. These attributes hold the latitude and longitude of old Westbury for one user and latitude and longitude of Hoboken for another user.

     Now I have to calculate the distance between the two users. This can be achieved using the SQL by using the following code

SyntaxEditor Code Snippet

SQRT(POWER(69.1 * ( @Latitude - convert(float,{user}.[Latitude])), 2) + POWER(69.1 * ( convert(float,{user}.[Longitude])  - @Longitute )   * COS(@Latitude / 57.29577951), 2))

.       But can this be achieved through aggregates?

        This is my question.

2020-05-29 14-07-58
Rajendra Singh

Hi Gowtham,

I think its distinct, is it?


Thanks

Rajendra Singh

2023-10-30 06-03-17
Gowtham

Raj wrote:

Hi Gowtham,

I think its distinct, is it?


Thanks

Rajendra Singh


Distinct means what? The SQL.

2019-09-24 18-41-25
Jorge Martins
 
MVP

I haven't tried it, but I'd say all Built-In functions that have a direct mapping on your DBMS are usable in an Aggregate's computed attribute.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.