Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Understanding combo boxes in web/mobile

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    284

    Understanding combo boxes in web/mobile

    Hi Guys

    We have a combobox that is populated by an SQL select in the choices attribute and works well in desktop.

    But now we want to use it in web/mobile.

    We assume that we will need a serverside proc to return a comma separated list for the choicelist.

    How do we call a function from the choices list?

    Non of of these work :

    myfunc()
    {myfunc()}
    $myfunc()
    ${myfunc()}
    $lianja.evaluate(myfunc())


    Any ideas?


    Thanks


    Simon

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,673
    Hi Simon,

    SQL select queries can be used in the Choices in web/mobile providing the target table(s) are in the same database as that used by the App.

    Regards,

    Yvonne

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,295
    Hi Simon,

    What is $lianja? That is nothing to do with Lianja. I think you mean Lianja.evaluate() not $lianja.evaluate()

    Is this to operate in standard form sections?

    If it is you will find that dynamic choice lists using SQL select statements are in fact available in the latest build. Have you downloaded it?

    You don’t need to call a server side proc that returns a comma separated list.

    By the way it’s.

    Lianja.evaluate(“myFunc()”)
    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

  4. #4
    Senior Member
    Join Date
    Jan 2014
    Posts
    284
    Thanks Barry

    Yes, it is a combobox on a standard canvas section. script is js.

    Tried your suggestion but when we enter Lianja.evaluate(“myFunc()”) into the choices box, all that is displayed is Lianja.evaluate(“myFunc()”) in the combobox in all cases (dev/runtime/web)

    It is taking the entry as a literal rather than evaluating a function. How do we tell it that it is a function?



    Our test function is just simply :


    function myFunc()
    {

    return 'one,two,three';

    };

    Will download latest but we will need to be able to do this one too for the future.

    Thanks

    Simon

  5. #5
    Senior Member
    Join Date
    Jan 2014
    Posts
    284
    Hi Yvonne

    Yes tables are within database.

    Will download latest RC

    Thanks

    Simon

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,295
    That’s a JavaScript function.

    1. where is it located
    2. JavaScript is case sensitive.
    3. that’s not server side, it’s a client side JavaScript function. I’m not surprised it’s not working.
    4. where did you get the idea that Lianja.evaluate() would ever work as a choice list string?

    You can test all this interactively in the JavaScript console of the browser, as I keep mentioning.
    Last edited by barrymavin; 2019-10-23 at 10:55.
    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

  7. #7
    Senior Member
    Join Date
    Jan 2014
    Posts
    284
    Ok we seem to be talking at cross purposes.

    We need to be able to control 2 comboboxes in code so that we can refresh the contents of combobox2 based on choices made in combobox1.

    We assumed that to control a combobox in code in a web app, we would need to call a js function (which may or may not then call a server side process).

    So what you are saying is that we can call a serverside VFP procedure directly from the choicelist property of the combobox and populate it using Lianja.evaluate(“myFunc()”)

    But we wouldn't be able to change the UI so we would still need to access js functions. How do we call a js function from the choicelist? We have read just about everything we can on forums & on line but cannot find the correct sytax or an example anywhere.

    The js function is in the main default custom library as set in the app settings. Our function name is all lower case so no case issues.


    So how do we call a function to populate the choicelist string?

    Trying to debug in a browser, there is no mention of the function running so don't think its getting that far.

    Cheers

    Simon

  8. #8
    Senior Member
    Join Date
    Jan 2014
    Posts
    284
    Also, historically in VFP we have used 2 column comboboxes - column 1 = display, column2 = data

    ie

    Name, id
    Steve Smith, 1
    Peter Nibbler,2
    Hungry Joe,3

    Can we accomplish the data write of column 2 whilst displaying column 1 or do we need a function call to do another SQL lookup?

    Thanks in advance

    Simon

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,295
    See this forum post from today.
    https://www.lianja.com/community/sho...0876#post20876

    You use the interactivechange delegate of the first Combobox to change the choicelist of the second Combobox.

    You can set the choicelist to a sql select statement

    combobox2.choicelist = “select distinct xxx from xxx where xxx”

    or

    combobox2.choicelist = Lianja.evaluate(“myServerSideFunc()”)

    or

    combobox2.choicelist = “a,b,c”

    or

    combobox2.choicelist = myClientFunc()
    Last edited by barrymavin; 2019-10-23 at 16:39.
    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

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,295
    In Lianja you would use data mapping to accomplish that. You don’t need two column Combobox to achieve that.

    See the doc in data mapping.
    https://www.lianja.com/doc/index.php/Data_Mapping

    and autosuggestions
    https://www.lianja.com/doc/index.php/Autosuggestions
    Last edited by barrymavin; 2019-10-23 at 16:51.
    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