Results 1 to 10 of 10

Thread: [solved] USE and SEEK / SEEK () as the target

  1. #1
    Member
    Join Date
    May 2013
    Location
    Bergkamen, Germany
    Posts
    33

    Question [solved] USE and SEEK / SEEK () as the target

    Hi there!

    It's very confusing and Lianja is not doing what I expect and understand from the documentation.
    The goal is simple: Open the table and search for a data record with LOCATE, SEEK / SEEK().

    So roughly:
    Code:
    OPEN DATABASE
    USE tabel
    LOCATE / SEEK / SEEK()
    BROW
    As an example here is the Lianja Southwind database.

    OPEN DATABASE SOUTHWIND // for all further lines

    USE table in 0 ALIAS MyTable -> table is open

    LOCATE FOR customerid = "EASTC" -> No error message
    BROW -> Shows the first record, not the 19th!

    SET ORDER TO customerid -> No error message
    SEEK("EASTC", MyTable) -> Error message: "')' was expected"
    SEEK("EASTC") -> No error message
    BROW -> Shows the first record, not the 19th!

    SET ORDER TO customerid -> No error message
    seek "EASTC" -> no error message
    BROW -> Shows the first record, not the 19th!

    I have already tried all types of play with '"' and parameters, etc. NOTHING leads to the goal. I have not written down all attempts here.

    BTW: Why does Lianja no longer know my table when I switch to DATA WORKSPACE in between and look at the table there? Must that be possible? Sometimes, when the table is open in the console, Lianja also shows me in Data WORKSPACE: "File 'customers.dbf' does not exist".
    What ??? Can I only go back to the table when I close all databases in DATA WORKSPACE ("X" in the toolbar) and open them again?

    Sorry, but sometimes I start to wonder if anyone on the data side is working with VFP-script here ... :-(

    In any case, I would be grateful for a few hints that go beyond the 3 lines in the documentation and reveal connections between the various commands / functions.
    It's no fun like that ...

    Thanks a lot in forehand!
    Last edited by barrymavin; 2020-12-08 at 20:08.
    Thanks
    Stefan

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    I am not a fan of noSQL and BROWSE, but try this:

    Code:
    LOCATE FOR customerid = "EASTC"
    ?found()
    .T.
    
    BROWSE for customerid = "EASTC"
    
    set order to customerid
    SEEK "EASTC"
    ?found()
    .T.
    
    ?seek("EASTC",mytable)
    .T.
    Last edited by josipradnik; 2020-12-07 at 09:20.

  3. #3
    Member
    Join Date
    May 2013
    Location
    Bergkamen, Germany
    Posts
    33
    Quote Originally Posted by josipradnik View Post
    I am not a fan of noSQL and BROWSE, but try this:

    [CODE]LOCATE FOR customerid = "EASTC"
    ?found()
    .T.

    BROWSE for customerid = "EASTC"

    set order to customerid
    SEEK "EASTC"
    ?found()
    .T.

    ?seek("EASTC",mytable)[
    .T./CODE]
    I have to do it like this not in an App. It's just a script to import data from other tables...

    All you !found() works, but not a BROWSE after a search. Why does the record pointer ist not on the record I searched for? A normal browse starts every time with the first record. I can't believe it's supposed to be like that. Then why would you need a browse?

    For example a BROWSE FOR ... is umpteen times slower than a SEEK and then a BROWSE, like I can do it in VFP... In this case I don't need the BROWSE in the script, but to check if my pointer is right, I want to browse...
    Thanks
    Stefan

  4. #4
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Lianja's BROWSE is rudiment and is shown modal.
    So you cannot move the pointer like in VFP old days when BROWSE played the main role of UI.
    Last edited by josipradnik; 2020-12-07 at 09:33.

  5. #5
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Stefan,

    The Browse in Lianja shows the cursor, unlike VFP where it brings you to the record. If you were to ? customerid from the Command Window, you would see the correct data. Also the BROWSE FOR doesn't seem to take advantage of the index tags. The VFP "browse" was a special creature all its own, for sure.

    Hank

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Use index key restriction before browsing.

    https://www.lianja.com/doc/index.php/SET_KEY

    Set order to customerid
    set key to range "EASTC","XXXXX" // all keys >= are included
    // set filter to Expr to apply optional filtering within the key range
    browse

    alternatively browse has a lot of additional built-in functionality:

    browse key "eastc"

    or

    browse key "bergs" for contacttitle="owner"

    or

    browse splitbar

    Name:  Screen Shot 2020-12-08 at 11.39.53 AM.jpg
Views: 264
Size:  81.9 KB

    Use it for pick lists...


    browse key "bergs" for contacttitle="owner" splitbar title "Customer list" caption "Select a customer"

    Name:  Screen Shot 2020-12-08 at 11.46.48 AM.jpg
Views: 258
Size:  72.5 KB

    Name:  Screen Shot 2020-12-08 at 11.47.04 AM.jpg
Views: 196
Size:  61.1 KB

    Restrict what the user can do...


    browse noappend nodelete noedit key "bergs" for contacttitle="owner" splitbar title "Customer list" caption "Select a customer"

    Name:  Screen Shot 2020-12-08 at 11.49.59 AM.jpg
Views: 278
Size:  77.8 KB


    All CRUD operations are controlled by the business rules in the data dictionary.

    Browse is hardly rudimentary.

    Also...

    seek "bergs"
    edit

    Name:  Screen Shot 2020-12-08 at 12.20.15 PM.jpg
Views: 252
Size:  61.9 KB


    seek "bergs"
    edit title "Edit Customers" caption "Customer"

    Name:  Screen Shot 2020-12-08 at 12.25.28 PM.jpg
Views: 262
Size:  63.0 KB





    Last edited by barrymavin; 2020-12-07 at 23:26.
    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
    Oct 2012
    Posts
    239
    hi Stefan,
    I also started Lianja as a VFP user and that is a very strange difference. I think BROWSE always starts from the "first" record (depending on the order and the filter). If you are using BROWSE NOWAIT, you can set the record pointer after the grid appears.
    If you use a GRID, there is a grid.goto() method that you can use to move poiter to the desired record.

  8. #8
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Quote Originally Posted by strato View Post
    hi Stefan,
    I also started Lianja as a VFP user and that is a very strange difference. I think BROWSE always starts from the "first" record (depending on the order and the filter). If you are using BROWSE NOWAIT, you can set the record pointer after the grid appears.
    If you use a GRID, there is a grid.goto() method that you can use to move poiter to the desired record.
    Not correct.

    See my reply for a solution.
    Last edited by barrymavin; 2020-12-07 at 23:58.
    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

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Quote Originally Posted by HankFay View Post
    Hi Stefan,

    The Browse in Lianja shows the cursor, unlike VFP where it brings you to the record. If you were to ? customerid from the Command Window, you would see the correct data. Also the BROWSE FOR doesn't seem to take advantage of the index tags. The VFP "browse" was a special creature all its own, for sure.

    Hank
    See my reply for a solution.
    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
    Member
    Join Date
    May 2013
    Location
    Bergkamen, Germany
    Posts
    33
    Ah! Thanks to everyone!
    So far I have assumed that the same commands/functions will also work the same, unless the documentation states something else.
    Unfortunately, BROWSE doesn't say that it always shows from the beginning.

    Doesn't matter, it would only be nice if deviations are noted in the description of VFP script commands and functions.
    Otherwise at some point you will go nuts. ;-)

    Thanks again! :-)
    Thanks
    Stefan

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