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

Thread: replace command

  1. #1

    replace command

    I have read all the form material but so far havent found the way to properly replace grid fields with new grid data

    My grid is sourced to a data file. I do the updates in the data file and then a skip 0 and refresh of the grid.

    The specific code is as follows

    Testlu1() &&testlkup8b() && &&LKUPL2('','L') &&DO LKUP2

    debugout MSTOCK
    debugout invdet.STOCK

    ENDI

    SELE (DETAIL2)

    REPLA stock with INV.stock,;
    invdet.unit with iif(invdet.unit=' ',iif(INV.unit=' ','EA',INV.unit),invdet.unit),;
    invdet.act with iif(EMPT(INV.act),MATCD,INV.act),invdet.COST WITH INV.COST
    SKIP 0
    GRID1.REFRESH
    DEBUGOUT INV.COST
    DEBUGOUT INV.RETAIL
    DEBUGOUT INV.UNIT



    debugout 'REPLACE'
    RETU

    The result is that the stock field which is the current grid field in focus when my valid is called gets updated but none of the other fields chg.

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

    Your replace is attempting to replace values in two different cursors (detail2 and invdet). Keep to one cursor target per replace statement.

    Hank

  3. #3
    I am taking the values from inv and entering the in (detal2) which is invdet

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Right, but REPLACE is by cursor. Make it one or the other. If you remove the invdet. from the rest of the statement, then, it should work.

  5. #5
    ok
    is this what u mean just take it out of the replace command like so:
    REPLA stock with INV.stock,;
    unit with iif(unit=' ',iif(INV.unit=' ','EA',INV.unit),unit),;
    act with iif(EMPT(INV.act),MATCD,INV.act),COST WITH INV.COST,retail WITH INV.retail

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    As hank mentions you are not doing a skip 0 in the invdet cursor so the buffer is not being flushed.
    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
    i am doing a skip zero after the replace

  8. #8
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    skip 0 only works in the active cursor not all...
    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
    If i for personal clarity replace the words active cursor with active table am i saying the same thing

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    In your original post you were replacing fields in 2 separate work areas (cursors). That is what I am referring to.

    The following command will force write all dirty buffers:

    flush

    instead of skip 0
    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