Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

change datatype on already created column?

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!
Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

change datatype on already created column?

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 ]

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

change datatype on already created column?

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...

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

change datatype on already created column?

Image

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

change datatype on already created column?

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.

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

change datatype on already created column?

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]}]}

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

change datatype on already created column?

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"}

Cristian Hidalgo
Posts: 0
Joined: Mon Nov 03, 2014 2:38 pm

change datatype on already created column?

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

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

change datatype on already created column?

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

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

Return to “Issues”