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

Thread: Problems with attribute section, orderby

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    304

    Problems with attribute section, orderby

    Problems with attribute section, orderby

    My data table has following index tags (list indexes) :

    Production DBX file: event.dbx
    Index TAG: DATE_SEARCH
    Key: DTOS(ereignis.date)
    Type: Character
    Len: 16
    Index TAG: DATEIDX
    Key: DTOS(ereignis.date)
    Type: Character
    Len: 16

    DeskApp: The table is not sorted by DATEIDX
    if I enter that in Section, Orderby.
    And in
    Cloudserver: The page is not built. No error is shows with F12.
    This only happens if I leave OrderBy empty.
    However, the data is then also not sorted and
    my function "suchereignis.prg" (Lianja.evaluate: search for a word in text "ereignis.beschreibung") , doesn`t work,
    which works with DeskApp.

    Georg

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

    For a web App, the OrderBy must be the name of a column in the section's bound table or column based expression. Multiple columns or expressions can be specified as a comma-separated list. It cannot be an index tag name. Think SQL.

    I do not understand what you mean by this:

    Cloudserver: The page is not built. No error is shows with F12.
    This only happens if I leave OrderBy empty.
    If you do not put a value in the Section OrderBy attribute the App does not load?

    There could be lots of reasons for the following, e.g. in an earlier version I saw, you were not opening the database and table - you need to do this for a server-side procedure.

    my function "suchereignis.prg" (Lianja.evaluate: search for a word in text "ereignis.beschreibung") , doesn`t work,
    which works with DeskApp.
    Regards,

    Yvonne

  3. #3
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,913
    Also, have you redeployed the database after the name change of the datum field?

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    304
    Thank you, Yvonne!

    Now I use dtos(ereignis.datum) as Section, OrderBy. (datum is a date)
    So the DeskApp is ok. And the Cloudserver shows also the right order.
    The function "suchereignis.prg" works ok too.

    WebApp and function "suchereignis.prg":
    Yes, I had forgotten to open database and table in the code. Now I do so:
    save datasession, open database, use table, restore datasession at the end.
    But there seems anything wrong for the webapp.
    How could I check the steps of this function in the webapp (f.e. with messagebox) ?

    Your last question:
    I have deployed the database. The date field is "datum". Earlier, an index had the same name. I corrected this.
    Last edited by gcjm; 2024-09-27 at 11:25.

  5. #5
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,913
    Hi Georg,

    Remember you can use the isserver() function in your LianjaScript server-side procedures to only do something if the prg is running on the server rather than the desktop:

    Code:
    if isserver()
    ...
    else
    ...
    endif
    When I looked at your ealier prg, I added this in the code working my way down until it did not return the expected value:

    Code:
    ret = 3
    return ret
    procedure ignore // so that the rest of the prg is ignore
    You can then call your server-side procedure from the Console tab of the web inspector/tools:

    Code:
    Lianja.evaluate("suchereignis('param')")
    and check the return value.

    You cannot use UI commands/functions like messagebox() in server-side procedures as they have no access to the UI.

    Regards,

    Yvonne

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    304
    Thank you!
    I had 2 little problems with the code (sorry):
    - I foolishly copied >procedure ignore< into my evaluate function too and was surprised that an error occurred and the result was "undefinded".
    - Lianja.evaluate("suchereignisse('param')") must be in my case
    Lianja.evaluate("suchereignisse(' " + mytext+ " ')").
    The various " and ' always confuse me, especially when I have more than one parameter.

    Another question about section, orderBy:

    I have >DTOS(ereignis.datum)<
    The table ereignis is sorted correctly in the desk view, but not at all sorted in the web view.
    The Console tab of the web inspector returns an empty string "".
    How can I specify the index for the table in js?

  7. #7
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,913
    Hi Georg,

    In the OrderBy, just specify the column name:

    Code:
    datum
    Think SQL:

    Code:
    select * from ereignis orderby datum
    You may need to create a tag with the same name for the desktop:

    Code:
    index on datum tag datum
    Regards,

    Yvonne

  8. #8
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,913
    Also, have a look at the format() function, a built-in Lianja JavaScript function to simplify using parameters.

    See some examples under the FORMAT() function.

  9. #9
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    304
    Dankeschön, Yvonne!

    Web is ok now. But sorry the desktop isn't sorted right.
    Very strange! Special Lianja problem?

    Georg

  10. #10
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,913
    Hi Georg,

    I would need more information to be able to offer any assistance.

    Regards,

    Yvonne

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