Page 1 of 2

change datatype on already created column?

Posted: Fri Nov 28, 2014 8:56 am
by Cristian Hidalgo

Hi, noob question/problem here...
1.Ive created a table on excel and converted it to json, then I imported it into the collection.
However the datatype for location [lat,long] is set to string on the collection how do I change it to geopoint?Do I need to reimport?If so ,how do I specify the datatype on excel so that it imports correctly into json?

  1. Im trying to create a Rank.bydistance (google maps API) function so when I click on a button the nearest 3 .positions of a specific type (specified column in collection) are shown on the map.(ive prepared the geopoints and types for those location along with the rest of the info).
    Anyone that could show me an example of how that could be written ,im stuck..
    Thanks!

change datatype on already created column?

Posted: Fri Nov 28, 2014 11:36 am
by Evgene Karachevtsev

Hello Cristian,

1) Please back up your collection
2) Change column type
3) Import location as array with 2 numbers, ex. [ 31.223123, 44.233123 ]


change datatype on already created column?

Posted: Fri Nov 28, 2014 12:29 pm
by Cristian Hidalgo

Ok, but theres no way on the Appery UI to change the type,once the column has been imported?
Have alreadytried imported them as the example you mention ,but the column says now to be of type array and not geopoint...


change datatype on already created column?

Posted: Fri Nov 28, 2014 12:32 pm
by Cristian Hidalgo

Image

This is how it looks on the excel sheet...


change datatype on already created column?

Posted: Fri Nov 28, 2014 12:57 pm
by Evgene Karachevtsev

Cristian, ,

[quote:]but theres no way on the Appery UI to change the type[/quote]
No, Appery.io won't changed it. It isn't AI.
[quote:]of type array and not geopoint...[/quote]
Geopoint is an edge case of an array that has only two numbers.


change datatype on already created column?

Posted: Fri Nov 28, 2014 1:26 pm
by Cristian Hidalgo

I do not mean that the UI should change it automatically when importing...I thought that perhaps on the edit column...apart from changing name you could change the datatype of the column...
The alternative is to specify the datatype on the excel sheet.
Is there a special syntax that I have to use to specify this?
ie.

{"data":[{"_id":"545ac827e4b03d005b62a27c","ID":1.0,"forsamling":"Angered","kyrkoherde":"p. ","forsamlingsnamn":"S:t P","gatuadress":"Titteridammstigen 4 ","postnr":"424 68 ","ort":"Angered","telefonnummer":"031–30 00","epost":"a href="mailto:angered@test.se" rel="nofollow"angered@test.se/a","lat":57.800256,"long":12.057982, "datatype" : "geopoint" "name": "location":[57.800256,12.057982]}]}


change datatype on already created column?

Posted: Fri Nov 28, 2014 1:41 pm
by Evgene Karachevtsev

Cristian,

Here is an example if JSON is used for creating one row with column of geolocation
"loc":{"value":[32.232362312,33.223232221],"type":"geopoint"}


change datatype on already created column?

Posted: Fri Nov 28, 2014 1:44 pm
by Cristian Hidalgo

Thx!


change datatype on already created column?

Posted: Fri Nov 28, 2014 5:56 pm
by Cristian Hidalgo

Any chance somebody can help out with the second question. Some hints?Or code examples?


change datatype on already created column?

Posted: Sat Nov 29, 2014 4:26 pm
by Egor Kotov6832188

We have example for your issue in Documentation:
http://devcenter.appery.io/documentat...

{
"location" : {
"$nearSphere" : [48.208, 16.373]
}
}