Xbrowse: insert a record

Xbrowse: insert a record

Postby Silvio.Falconi » Thu Feb 14, 2013 3: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse: insert a record

Postby Franklin Demont » Thu Feb 14, 2013 5: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: Select all  Expand view

// 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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Xbrowse: insert a record

Postby Silvio.Falconi » Thu Feb 14, 2013 7: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse: insert a record

Postby FranciscoA » 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=6&t=23673&start=0&hilit=insertar+registro

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Xbrowse: insert a record

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 107 guests