JSDO Read filter using a field value - Forum - Mobile - Progress Community

JSDO Read filter using a field value

 Forum

JSDO Read filter using a field value

This question is not answered

Hello,

I am trying to perform a JSDO read operation to search for a contact (Object) using its email address (field). How can I change the JSDO Read 'filter' to take in the email address instead of the ID to get the record I want? Could anyone point me out in the right direction please?

All Replies
  • There is filter pattern sample code, see the link in community.progress.com/.../16042.aspx. You could program a custom read method/procedure also, operation="invoke", which takes an input param table with all the filter records you want (and more if you create more params, f.e. for sorts, paging, authentication) and create the query on the appserver. I for myself prefer that and it's easier to program.

    --

    Kind regards,

    Stefan Houtzager

    Houtzager ICT consultancy & development

    www.linkedin.com/in/stefanhoutzager

  • Hello,

    Based on your description, it looks like you are using a Rollbase backend.

    Currently, with a Rollbase backend, the READ operation does not have support for a filter.

    You can use the getViewAll INVOKE operation to get all the contacts.

    In recent versions of Rollbase, the INVOKE operation uses a mode that populates the JSDO memory so that you can use the find(), getData(), foreach() and other methods in the JSDO API in JavaScript.

    Once you find the record, you can either use the record that you found or use the ID to call the READ operation if you are using the visual mapping to handle the record.

    I hope this helps.

  • Ok, I'm assuming you guys know a lot about Rollbase Mobile than myself :) I have just recently started working with Rollbase Mobile and have done the basic tasks of CRUD. Could you please provide me with documentation that would help me to understand Rollbase mobile in depth? The Rollbase mobile documentation (documentation.progress.com/.../Rollbase ) does not really provide a lot of information. I would like to customize the mobile app using REST API (if there's documentation available to explain all of it), JSDO API (documentation?) and see if it is possible to use script components to manipulate the mobile app as we do on the actual Rollbase pages. It would be of great help if you guys could point me in the right direction.

    Cheers.

  • Take a look at the OpenEdge Mobile documentation.

    - Mobile Applications

    - Progress Developer Studio for OpenEdge Help

    Administration

    community.progress.com/.../2352.openedge-11-5-product-documentation.aspx

    Scroll down to OpenEdge Mobile

  • Helo ,

    Thanks for the information. Is this the same as Rollbase Mobile?

  • Hi,

    The JSDO API is the same. Rollbase does their read operation a little differently and does not support change tracking.

    Shelley

  • Hello,

    Here are some few links in case that they help.

    You can write JavaScript code to customize an App in the Mobile App Builder. You can call any JavaScript code including as part of the app. For example, jQuery and the JSDO files are included with the app.

    In addition to the JSDO Services, you can use REST Services in the Mobile App Builder and call any REST API.

    This includes the regular REST endpoints provided by Rollbase.

    However, as it was answered in another thread, the Mobile API and the REST API have different sessions and the Mobile session is not used by the REST endpoints. You would need to manually create the session using basic authentication.

    Link to the Mobile App Builder documentation:

       docs.mobile.rollbase.com

       documentation.progress.com/.../mobile-app-builder

    White paper on how to build a Rollbase Mobile Application with all CRUD Operations (it looks like you have already looked at this document):

       community.progress.com/.../1133.aspx

    The documentation on the JSDO and the Session objects used for Mobile can be found in the Mobile Applications book for OpenEdge:

       documentation.progress.com/.../dvmad.pdf

       documentation.progress.com/.../openedge115

    I hope this helps.

  • I was reading up on the REST service API. I would like to login using REST API when the Login button is pressed and get the session ID and use it everywhere else. Is that possible? I have not yet been able to get the session ID.

  • Hello,

    The Mobile API and the REST API have different sessions.

    The session of one is not available to the another. (For example, notice that the session id sent from the server is generally sent as an HttpOnly cookie which is not available to JavaScript, only to the web browser internally.)

    You could call the REST API using basic authentication.

    You would need to pass the username and password to Authorization header encoded using Base64.

    See the following articles as references:

    - documentation.progress.com/.../index.html

    - documentation.progress.com/.../mobile-app-builder

    - en.wikipedia.org/.../Basic_access_authentication

    I hope this helps.