Forum Post: RE: Storing values in dataset

  • Thread starter Thread starter mflanegan
  • Start date Start date
Status
Not open for further replies.
M

mflanegan

Guest
Thanks Edsel. This sorted my issues out. I’m am creating my dataset using this on the client side: var dataSet = {}; dataSet.dsOrder = {}; dataSet.dsOrder.ttOrder = []; I don’t have a problem appending records to the dataset but how would I populate a grid using this dataset as I am not using business entities etc. to get my data back? Meyrick Flanegan Developer - Managed Services Email: mflanegan@elcb.co.za ELCB Information Services (Pty) Ltd Customer Service Email elcb@elcb.co.za · www.elcb.co.za E A S T L O N D O N Tel: +27(43) 704 0700 Fax: +27(43) 704 0701 J O H A N N E S B U R G Tel: +27(11) 879 6179 Fax: +27(11) 454 0384 P O R T E L I Z A B E T H Tel: +27(41) 373 0529 Fax: +27(86) 650 0135 Disclaimer From: egarcia [mailto:bounce-egarcia@community.progress.com] Sent: 11 December 2014 01:17 PM To: TU.Mobile@community.progress.com Subject: RE: [Technical Users - Mobile] Storing values in dataset RE: Storing values in dataset Reply by egarcia Hello Meyrick, The jsdo object is a reference that points to Session object which also points to the JSDOs that it contains. Calling JSON.stringify() for the jsdo reference would give you the exception "Converting circular structure to JSON". In this scenario, you actual want to get to just the data of the JSDO (jsdo.getData()). You can call getData() to get to the data and then call addRecords() to populate the JSDO. In release 3.1 of Mobile, we have added new APIs to the JSDO to save the data to local storage and then retrieve it. The APIs are the following: - saveLocal() - readLocal() - addLocalRecords() - deleteLocal() The methods use a default "local storage area" name but you can specify a parameter if you prefer to use a different name. By default all the data in the JSDO (data and changes) are stored. There is a parameter that you can specify to only save the changes. There are also support methods hasData() and hasChanges(). Here is how your could would look with the new APIs: function jsdoTest() { var jsdo = WebService_beBasicSearch_JSDO.jsdo; // Put the object into storage try { jsdo.saveLocal(); } catch(e) { console.log("Exception while executing saveLocal();"); } // Retrieve the object from storage try { var hasLocalData = jsdo.readLocal(); } catch(e) { console.log("Exception while executing readLocal();"); } console.log('retrievedObject: ', JSON.stringify(jsdo.getData())); } I hope this helps. Stop receiving emails on this subject. Flag this post as spam/abuse.

Continue reading...
 
Status
Not open for further replies.
Back
Top