Results 1 to 5 of 5

Thread: IN directive for workarea based commands

  1. #1
    Member
    Join Date
    Feb 2012
    Location
    Earth.Europe.Germany.Bavaria.Obing
    Posts
    47

    IN directive for workarea based commands

    As we all know, xBase is workarea-centric in regards of the command-scope. Any record related command is based on the position in the current workarea. Therefor if you are at EOF() in the current workarea, this command will do nothing:
    REPLACE otherArea.SomeField with Something

    You would need to write a bunch of lines like that:
    cOldAlias = ALIAS()
    SELECT OtherAlias
    REPLACE SomeField WITH Something
    SELECT (cOldAlias)

    In VFP we have the IN clause to temporarily shift the controlling workarea, thus the above 4 lines are now

    REPLACE SomeField WITH SomeThing IN OtherAlias

    The IN clause temporarily shifts the workarea for that command only.

    Would be great if we could get that on all workarea related commands (REPLACE, BLANK, APPE, COUNT, CALC, BROWS, SCAN, LOCATE, CONT, SET RELA, SET FILT etc)
    Interestingly, the USE already has the IN clause.

    Thanks for considering!
    Last edited by woody-soft; 2021-01-02 at 11:29.
    wOOdy

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

    IN is already implemented with REPLACE.

    Please resubmit this post as an Enhancement Request ticket and I’ll have a look.
    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. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    I have added the IN clause to the following commands. The only caveat is that the IN clause must come directly after the command keyword as IN is also an operator in Lianja.

    See doc.
    https://www.lianja.com/doc/index.php/IN_Predicate

    REPLACE IN <alias/expr> ...
    DELETE IN <alias/expr> ...
    RECALL IN <alias/expr> ...
    APPEND IN <alias/expr> ...
    COUNT IN <alias/expr> ...
    LIST IN <alias/expr> ...
    BLANK IN <alias/expr> ...
    SUM IN <alias/expr> ...
    AVERAGE IN <alias/expr> ...
    CALCULATE IN <alias/expr> ...
    LOCATE IN <alias/expr> ...
    CONTINUE IN <alias/expr> ...
    SCAN IN <alias/expr> ...
    LOOP IN <alias/expr> ...
    EXIT IN <alias/expr> ...
    Last edited by barrymavin; 2021-01-03 at 09:32.
    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
    Member
    Join Date
    Feb 2012
    Location
    Earth.Europe.Germany.Bavaria.Obing
    Posts
    47
    Thanks for implementing!

    Regarding the IN operator: in VFP this is only allowed in SQL commands, hence the difference between Lianja and VFP syntax. In VFP's NoSQL code, you need to use INLIST().
    But me thinks, that placing it as the first directive is absolutely no problem as long as it is somehow documented for the newcomers

    BTW: The Lianja SKIP and USE command has the IN clause as optional parameter without the requirement of being the first directive (if I believe the documentation )

    Just noticed that DELETE/RECALL and SCATTER/GATHER might also be candidates for the IN additions.
    wOOdy

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    SKIP and USE yes you are correct.

    IN and INLIST are different in that IN can have a SQL SELECT as its argument.

    DELETE and RECALL have been implemented I did not list them.
    Last edited by barrymavin; 2021-01-03 at 06:53.
    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