ImNotaRobot
Posts: 0
Joined: Wed Jan 08, 2014 6:33 pm

Trouble with formatting numbers into currency?

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');)

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Trouble with formatting numbers into currency?

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

IamRobot
Posts: 0
Joined: Wed Jan 08, 2014 6:57 pm

Trouble with formatting numbers into currency?

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Trouble with formatting numbers into currency?

Hi,

Let us know if you need help.

ImNotaRobot
Posts: 0
Joined: Wed Jan 08, 2014 6:33 pm

Trouble with formatting numbers into currency?

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Trouble with formatting numbers into currency?

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

Return to “Issues”