Page 1 of 1

Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 9:10 pm
by pboloz

I would like to limit it to 6 digits after dot
Image
Image


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 9:48 pm
by ridxery

Use Javascript to format it like this:

Number(1.33555).toFixed(2); // 1.34 , toFixed() rounding up too, if you dont believe me test it :

http://jsfiddle.net/FQTqk/730/


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 10:14 pm
by pboloz

Thanks, but I am afraid I need step by step instruction where to add this JS. Somewhere when I do mapping?


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 10:30 pm
by ridxery

you can do it on mapping tab like create 2 local variables from right top at data mapping tab, then you can click to add JS (next to the created local variable) you should see a tab saying,

function (value , element) {
parseFloat(value).toFixed(6);
}

PS: you dont need to create local variables to do this, any entity got JS button next to them however saving user's location would be good , you might need it again.


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 10:32 pm
by ridxery

you dont need to create local variables to the this, any entity got JS button next to them however saving user's location would be good , you might need it again.


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 10:54 pm
by pboloz

I have put it here but it did not work

Image

Have I done sth wrong?

Image


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 10:57 pm
by ridxery

var x = parseFloat(value).toFixed(6);

return x;

try this one.


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 11:12 pm
by pboloz

Awesome! Thanks!


Is there anyway I can limit the string length in the database or before sending latitude and longitude to the database?

Posted: Tue May 13, 2014 11:13 pm
by ridxery

no problemo :)