Batching - Forum - Mobile - Progress Community

Batching

 Forum

Batching

This question is not answered

Hi there,

I am able to store the ROWID for next set of Records to Batch and get those records. How ever, on the client it does not keep the old records i.e. I want to append to the old records. How would I append to the existing dataset on the client?

e.g:

First Read of the dataset I get records 1 and 2 and send that to the client for display. Then I get my next batch of records,3 and 4. When I send this to the client, it only displays 3 and 4. I want it to display records 1,2,3 and 4.

All Replies
  • This is quite an urgent post. Does anyone have any information on this for me. Am I doing this the correct way in mobile or is there another way of doing batching?

    Thanks in advance.

  • If it is with OE, please check the sample I've provided you that does batching.

    The batching on that sample is a set of records at each request and allows you to navigate back and forward.  The sample I've shared with you has the code on the OE backend and supporting javascript for the frontend.

    I've never done an Incremental batch, but if I was to write one, I would try this approach (might not work):

    - I would study this https://community.progress.com/community_groups/mobile/f/17/t/8529.aspx to see how to consume data services using JavaScript and the JSDO apis

    - I would try to instantiate my own trigger for the AfterFill to append the data  to my list using JavaScript  (instead of having it visually mapped to the list)

    Hopefully someone has done it in the past and would save you the research time!  Good luck!

    Ricardo

  • Thank you very much, I will let you know if this works.
     

    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: Ricardo Perdigao [mailto:bounce-rperdiga@community.progress.com]
    Sent: 21 November 2014 08:31 AM
    To: TU.Mobile@community.progress.com
    Subject: RE: [Technical Users - Mobile] Batching
     
    Reply by Ricardo Perdigao

    If it is with OE, please check the sample I've provided you that does batching.

    The batching on that sample is a set of records at each request and allows you to navigate back and forward.  The sample I've shared with you has the code on the OE backend and supporting javascript for the frontend.

    I've never done an Incremental batch, but if I was to write one, I would try this approach (might not work):

    - I would study this https://community.progress.com/community_groups/mobile/f/17/t/8529.aspx to see how to consume data services using JavaScript and the JSDO apis

    - I would try to instantiate my own trigger for the AfterFill to append the data  to my list using JavaScript  (instead of having it visually mapped to the list)

    Hopefully someone has done it in the past and would save you the research time!  Good luck!

    Ricardo

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

  • Hi Ricardo,

    we have tried using that code from the link in a button on a click event. it bombs out when we assign the jsdo variable.

    any ideas why?

  • ok got past that. please ignore.

  • Hello Meyrick,

    I just wanted to give you a couple of quick tips.

    You can use the "JSON Filter Pattern" as a way to do batching.

    You specify "top" to indicate the number of records to return and "skip" to indicate the page.

    The following article in the wiki provides some information and points to a sample Business Entity:

    community.progress.com/.../2279.business-entities-using-the-json-filter-pattern-code-samples.aspx

    If you want to add to an existing set of records in the JSDO memory, you could use an INVOKE operation.

    The backend code for the invoke method could also use the JSON Filter Pattern.

    Then you would use the addRecords() API in the JSDO to add the records to the JSDO memory.

    I hope this helps.

  • How do we access the JSDO memory using javascript? we getting totally confused with this whole thing.

  • Hello,

    You can access the JSDO memory using JavaScript by getting a reference to the JSDO from the JSDO Service.

    Example:

       MobilityDemoService_dsCustomer_JSDO.jsdo.sort(["CustNum"]);

    I hope this help.

  • I am able to append to dataset and I can see the new records are in there by messaging the jsdo.
     
    How do I now refresh/update the grid to see the updated jsdo.
     
    I am using a grid control and not a list control.
     

    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: 24 November 2014 03:11 PM
    To: TU.Mobile@community.progress.com
    Subject: RE: [Technical Users - Mobile] Batching
     
    Reply by egarcia

    Hello,

    You can access the JSDO memory using JavaScript by getting a reference to the JSDO from the JSDO Service.

    Example:

       MobilityDemoService_dsCustomer_JSDO.jsdo.sort(["CustNum"]);

    I hope this help.

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

  • Hello Meyrick,

    You just need to call the READ Service in the same way as already do to show the records on the grid control.

    The READ Service has a request parameter called "readLocal".

    When readLocal is not specified or "false", the records are from the server.

    When readLocal is "true", the records are read from the JSDO memory.

    To set the "readLocal" parameter, you can either map the "readLocal" parameter to a localStorage variable and change the value to "true" or "false" as needed.

    Alternatively, you can just create another usage of the READ Service and specify "false" for "readLocal" directly in the Request tab.

    I hope this helps.

  • Thanks, that solved all my problems. The batching is working now.
     

    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: 24 November 2014 05:26 PM
    To: TU.Mobile@community.progress.com
    Subject: RE: [Technical Users - Mobile] Batching
     
    Reply by egarcia

    Hello Meyrick,

    You just need to call the READ Service in the same way as already do to show the records on the grid control.

    The READ Service has a request parameter called "readLocal".

    When readLocal is not specified or "false", the records are from the server.

    When readLocal is "true", the records are read from the JSDO memory.

    To set the "readLocal" parameter, you can either map the "readLocal" parameter to a localStorage variable and change the value to "true" or "false" as needed.

    Alternatively, you can just create another usage of the READ Service and specify "false" for "readLocal" directly in the Request tab.

    I hope this helps.

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.