How do i calculate the sum of 2 or more numbers in the database
OMG it worked. Thank you so much for a phenomenal response. The kids are gunna be so excited about this. Thank you!
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
OMG it worked. Thank you so much for a phenomenal response. The kids are gunna be so excited about this. Thank you!
Alena, I have one more question about some JavaScript code I'm having a problem with. I've been studying the two Appery.io documentation pages referenced above and I have one snippet that works and the other that fails. I've implemented a search box and I'm querying my dataBase for the value and I want it to return with the matching info. EVERYTHING works when I force the number I'm querying, but it fails if I try to use just the 'value' parameter. Can you give me a quick tip on what's the problem?
I even used the Test feature in the dBase query_service tool to verify the problem still exists & it does. Using the passing script here yields a 'Test Successful' result with the data flowing & displaying correctly in my app. But when I use the simple value parameter it fails. Both Team & the input are number type. And my database has Team has a number.
Fails: return '{"Team":value}’;
PASSES: return '{"Team":138}';
[
{
"id":"534613dde4b07b0d80162555",
"Comments":"138 rocks",
"LowGoal":6.0,
"HighGoal":11.0,
"Autonomous":0.0,
"Round":1.0,
"Assists":5.0,
"Catch":4.0,
"Opponent":499.0,
"Team":138.0,
"Alliance":500.0,
"BallPickUp":21.0,
"QualityDriver":10.0,
"Speediness":10.0,
"EstimatedScore":186.0,
"Truss":3.0,
"acl":{
"":{
"write":true,
"read":true
}
},
"createdAt":"2014-04-10 03:45:33.130",
"updatedAt":"2014-04-10 03:45:33.130"
},
{
"id":"5346ffb6e4b013c661e61db4",
"Comments":"What what?",
"LowGoal":2.0,
"HighGoal":4.0,
"Autonomous":10.0,
"Round":2.0,
"Assists":11.0,
"Catch":3.0,
"Team":138.0,
"BallPickUp":29.0,
"QualityDriver":18.0,
"Speediness":44.0,
"EstimatedScore":82.0,
"Truss":1.0,
"acl":{
"":{
"write":true,
"read":true
}
},
"createdAt":"2014-04-10 20:31:50.090",
"updatedAt":"2014-04-10 20:31:50.090"
}
]
Hi Gregory.
That is not hard to do query with number.
Please try to pass following steps to understand approach.
1 Make mapping from your text field to your service "where" clause:
2 Click on "Add JS"/"Edit JS". And fill following code in the JS editor:
precode
return '{"Team": "' + value + '"}';
/code/pre
Note your value should be exactly the same as in the DB.
If you want search by partially content you can do it with "regex" clause. Please see tthi s tutorial : http://docs.appery.io/tutorials/build...
I think we're miscommunicating. When I use the JS script you provided, the return is emtpy
[
]
But when I use the other script that Passes, it returns all the data because it did the search correctly. It's like the search thinks it's a string, when it should be treating it like a number...
Hello!
If column type is number, you have to send number, not string. Delete unnecessary quotes: prereturn '{"Team": ' + value + '}';/pre