Results 1 to 4 of 4

Thread: My evaluate function dont work .Why??

  1. #1
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    67

    My evaluate function dont work .Why??

    Ok I have simple evaluate function this is call when the combo change the value. then if found the record return "SI" and if not return "NO".
    this is the java function
    function page1_section1_field1_interactivechange()
    {
    // insert your code here
    ww_selg=Lianja.get("page1.section1").getJSON();
    cc_selg=json_encode(ww_selg);
    var resultado=Lianja.evaluate("gruposfunction('"+cc_se lg+"')");
    Lianja.showMessage('Seleccionando Grupo ..'+resultado);
    Lianja.get("page1.section1").refresh();
    };

    this is my prg function:
    gruposfunction.prg
    parameter ww_clave
    objeto=json_decode(ww_clave)
    valor = objeto.field1
    save datasession
    open database prueba_tablas
    if .not. used("encgpo")
    use encgpo exclusive in 0
    endif
    select encgpo
    locate eg_nombre = alltrim(valor)
    if found()
    a1=eg_grupo
    restore datasession
    return "Si"
    else
    restore datasession
    return "No"
    endif
    and my output is this:
    Name:  2021-11-10.jpg
Views: 465
Size:  69.3 KB

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,187
    Hi Gontran,

    Why is there a space between se and lg in your evaluate call?

    One way to check your evaluate calls is to open the Command Window (off the Window dropdown in the LAB) and run it from the command window (with the values supplied to variables as necessary of course). If it runs there, you should be good.

    Hank

  3. #3
    Member
    Join Date
    Oct 2012
    Location
    México city
    Posts
    67
    Hello thanks for the time , that space , not exists in my code I dont know why is in the text. Ok I try to see in the console but. This wotk in the web app?

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,359
    Blog Entries
    22
    Hi gontran,

    If all you need is field1 then why not just send that as an argument rather than all that JSON.

    It looks to me like the null values may be the issue as they won’t parse on the server.

    When sending JSON like that you should base64_encode() it on the client and base64_decode() it on the server.

    I also note that you are opening a table on the server EXCLUSIVE which you should not do in a web app as many users will be using the system.

    The locate statement

    locate eg_nombre = alltrim(valor)

    should be

    locate for eg_nombre = alltrim(valor)
    Last edited by barrymavin; 2021-11-10 at 17:31.
    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