Page 1 of 1

Trouble with formatting numbers into currency?

Posted: Wed Jan 08, 2014 6:41 pm
by ImNotaRobot

I am creating an app that totals a grocery bill. I have successfully been able to total it, but am not able to format it with the $. I am doing everything in my server code. I am using the numeralJS dependency. I do not know how to insert the

var string = numeral(1000).format('$0,0.00');)

into my response.

Here is my server coding:

var DB_id='52b08c08e4b03c65ed00ddb3',
collectionName='grocerylist',
columnName='price';
try {
query = Collection.query(DB_id, collectionName);
var i, len, value, sum = 0;
for(i = 0,len = query.length; i < len; i++) {
value = parseFloat(query[columnName]);
if (value) {
sum +=value;
}
}
response.success({Total:sum}, "application/json");
} catch (e) {
response.success({message: e.message, code: e.code},
"application/json");
}

var string = numeral(1000).format('$0,0.00');)


Trouble with formatting numbers into currency?

Posted: Wed Jan 08, 2014 6:53 pm
by ImNotaRobot

Trouble with formatting numbers into currency?

Posted: Wed Jan 08, 2014 6:57 pm
by maxkatz

Setting for Response are explained here: http://docs.appery.io/documentation/b...


Trouble with formatting numbers into currency?

Posted: Wed Jan 08, 2014 6:57 pm
by IamRobot

Completely Start over and then rewrite all the script and see if that works


Trouble with formatting numbers into currency?

Posted: Thu Jan 09, 2014 7:25 am
by Kateryna Grynko

Hi,

Let us know if you need help.


Trouble with formatting numbers into currency?

Posted: Mon Jan 13, 2014 6:03 pm
by ImNotaRobot

Its ok, I had to figure it out on my own. It took me 5 hours, but was worth it.


Trouble with formatting numbers into currency?

Posted: Mon Jan 13, 2014 6:18 pm
by Kateryna Grynko

Thank you for the update, glad it's working!