FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse: insert a record
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Xbrowse: insert a record
Posted: Thu Feb 14, 2013 03:01 PM

If I insert two records in a xbrowse, how do I insert a new record between the two records I inserted before?

001000 product1000
002000 product2000

I wish insert a record 001100 poduct1100 between they ..it is possible with xbrowse ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Xbrowse: insert a record
Posted: Thu Feb 14, 2013 05:28 PM
Yes it is possible (ARRAY ! ) as :

aIns(oBrw:aArraydata,nAt,xValue,.T.)

oBrw:Refresh()

With a Dbf it is more complicated , but appending a record and defining the apropriate indexfiles must be enough to insert the record at the desired place.

If not , you can try next routine
Code (fw): Select all Collapse
// Not used , but working !
PROC InsertDbf()
****************
LOCAL nInsert := 10
local cTmpDbf1 , cTmpDbf2 , cTmpDbf3
local cPath,cFileName,cExtension

USE CUSTOMER EXCLUSIVE
Hb_fNameSplit(DbInfo(DBI_FULLPATH),@cPath,@cFileName,@cExtension)        
IF EMPTY(cPath)
    cPath := CurDrive()+":\"+CurDir()
END
IF Right(cPath,1) <> "\"
    cPath += "\"
END

cTmpDbf1 := cPath + cFileName + "_"
cTmpDbf2 := GetEnv("TEMP") + "__" + cFilename
GO TOP
COPY TO (cTmpDbf1) NEXT nInsert - 1
COPY TO (cTmpDbf2) REST
USE (cTmpDbf1) 
APPEND BLANK
APPEND FROM (cTmpDbf2)
DELETE FILE (cTmpDbf2)

RETURN
test
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Xbrowse: insert a record
Posted: Thu Feb 14, 2013 07:33 PM

Frank,
and if we insert a new field called row and make :
row code product
1 001000 product1000
2 002000 product2000

we take the last and add +1 to row
3 002000 product2000

while the New record must have the last number saved before
2 0011000 product1100

and the index on row ...

just an idea but I not Know if it is possible

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Xbrowse: insert a record
Posted: Thu Feb 14, 2013 11:52 PM

Silvio, The code that Frank shows, it's fine for me, but you wants use a field called row. Please take a look at: (maybe it help you)

viewtopic.php?f=6t=23673start=0hilit=insertar+registro

Regards.

&&&

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Xbrowse: insert a record
Posted: Fri Feb 15, 2013 10:30 AM

Perhaps I found a solution often recreate a new temp archive
I must only try it with a archive big

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion