If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
cascadedev
Posts: 39
Registered: ‎03-09-2014
My Device: Simulator
My Carrier: NA
Accepted Solution

User Input to JSON, and Mathematical Operation

Hello guys,

 

Now, i'm currently building another app, and i want to use JSON as my database. There will be multiple inputs (user inputs, INTEGER) from textfield which will be saved in JSON, then i want to apply mathematical addition to each input which is saved in JSON database (total value), then display it in the user interface. I also want to try this with XML, but i don't know if i could do this with XML.

 

The sample app given in the documentation (saving data with JSON) is not applied with user inputs, but we specify the data. Also there's no example of mathematical operation in database. I still don't know the concept, and how to write the code.

 

Any help would be appreciated. Thank you.

Please use plain text.
Developer
Zmey
Posts: 1,510
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: User Input to JSON, and Mathematical Operation

Hi,
Mathematical operations can be performed in the app itself.

1) Create input controls, a button which will trigger the operation. On click, calculate the result, update the result field, then save the inputs and the result to DB, JSON or XML file.

2) When the page is loaded in onCreationCompleted handler on Page read the saved values (if any) and fill the controls with the data.

If you need help, please post the code you have so far and someone may be be able to help with specific problems.

Andrey Fidrya, @zmeyc on twitter
Please use plain text.