-
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.
-
Hi,
Your replace is attempting to replace values in two different cursors (detail2 and invdet). Keep to one cursor target per replace statement.
Hank
-
I am taking the values from inv and entering the in (detal2) which is invdet
-
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.
-
:) 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
-
As hank mentions you are not doing a skip 0 in the invdet cursor so the buffer is not being flushed.
-
i am doing a skip zero after the replace
-
skip 0 only works in the active cursor not all...
-
If i for personal clarity replace the words active cursor with active table am i saying the same thing
-
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