PDA

View Full Version : replace command



Quailco
2016-03-03, 14:46
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.

HankFay
2016-03-03, 16:52
Hi,

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

Hank

Quailco
2016-03-03, 16:56
I am taking the values from inv and entering the in (detal2) which is invdet

HankFay
2016-03-03, 17:06
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.

Quailco
2016-03-03, 17:28
:) 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

barrymavin
2016-03-03, 18:57
As hank mentions you are not doing a skip 0 in the invdet cursor so the buffer is not being flushed.

Quailco
2016-03-03, 20:42
i am doing a skip zero after the replace

barrymavin
2016-03-03, 22:16
skip 0 only works in the active cursor not all...

Quailco
2016-03-03, 22:19
If i for personal clarity replace the words active cursor with active table am i saying the same thing

barrymavin
2016-03-03, 22:27
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

Quailco
2016-03-03, 22:34
ok thanks thats good to know.

but the original was replacing fields in the grid table with fields from another work area. not updating two different work areas. BTW updating 2 different work areas from a third work area does wor in VFP. I will make sure i do not do that in this application

barrymavin
2016-03-03, 22:42
I have no idea what you are referring to now.

In your original post.... do a FLUSH afterwards to flush all work areas..... Thats what I'm suggesting. You can update multiple work areas... You just need to flush them all to disk as row buffering is on in Lianja..

If you discover something that does not work as it does in VFP then submit a ticket.