Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Getting the mobile app / server data clear

  1. #11
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    Hi Barry

    We get the idea thanks. That uses field display values rather than table data. In a tablet scenario that makes sense.

    Done that way, it would be easy to change a single field value in a single call. What about bulk changes of several field at the same time on the serverside?

    Wish we coud make out the text clearly in the screenshot but looks like you are using + or * chars around the variable ie + var + or maybe * var * with something outside that. We've spent all day trying to guess the syntax !!

    Is the new example in RC54? Can't see any of the normal example apps in this build. What have you called it and we will search the hard drive.

    Cheers

    Simon

  2. #12
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    It's in the build as I said. Example_pclookup

    Read the code if you cant read the screenshot. It's basic JavaScript adding strings together just as you would do in your VFP code.

    Changing multiple fields is clearly just a repeat of the statement that sets the text of the field based on the JSON object returned from the getAddressDetails() server side proc. If you follow the url I pasted in as a comment it will let you subscribe to their API for looking up address details for a given post code.

    You can pass complex objects back to the client from the server using json_encode() and reference the members of the object in the client as I demonstrate in the example code.

    As has already been explained you can either update the cursor or update the field in the UI which will result in the cursor associated with the controlsource being updated on the server when the section is saved.

    Run the example and read the code you will learn from that.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #13
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    Hi Barry

    Works well - thank you. We would never have found the right syntax by trial & error.

    One question... when we change the value of the textbox, is there a way to commit the changes other than writing the data separately for each field using cursorname.setData("fieldname", newvalue)?

    When we call Lianja.get("pagen.sectionn").save() or Lianja.get("pagen.sectionn").refresh() the data reverts to the old values.

    Can we commit either the section or the page or the lot in a single command?

    Cheers

    Simon

  4. #14
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    See screenshots below.

    As I mentioned previously. You can save() the section or update() the underlying cursor.

    You are probably seeing data reverted back in desktop as you are not in "edit" mode on the section.

    Name:  Screen Shot 2019-09-12 at 2.58.06 PM.jpg
Views: 173
Size:  67.5 KB

    Name:  Screen Shot 2019-09-12 at 3.04.19 PM.jpg
Views: 86
Size:  56.2 KB
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #15
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    Thanks Barry

    Something is not right here...

    Runtime and in edit mode (manually from bottom toolbar). Page set to full page edit

    Lianja.getCursor("cust").update(); - still reverts when you press save on bottom toolbar


    Lianja.get("page2.section2").save();
    Error: Method 'save' undefined on this object


    and to ensure it's not a case issue
    TypeError: Result of expression 'Lianja.get("page2.section2").Save' [undefined] is not a function.

    Don't know why because "save" is a method in the documentation



    The only way we can get it to save is :

    var cust = Lianja.getCursor("cust");

    cust.setData("adl1", addrDetails.adl1);
    cust.setData("adl2", addrDetails.adl2);
    etc

    So we can't update the cursor and we can't save the section. Is there some "master edit mode" we have to be in first? Is the edit button on the bottom toolbar not enough?

    What are we missing?

    Cheers

    Simon
    Last edited by SpringBox; 2019-09-13 at 08:56.

  6. #16
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Normally you "edit" from the form action bar and "save" or "cancel" from there.

    Normally you don't need to work at a low level writing in JavaScript as Lianja does it all for you.

    save() on a section when hand coding javascript was not exposed. It is in the latest build as is cancel().

    Try the example i provided to you. If it works there then study the code I provided.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us