I opened the data base with
oServiziSingoli := TDatabase():Open( , "SERVIZI", "DBFCDX", .T. )
oServiziSingoli:bTrigger := { || If( Empty( ORDINE ), ORDINE := RECNO(), nil ),;
If( Empty( ID ), ID := strzero(RECNO(),4), nil )}
oServiziSingoli:SetOrder( 1 )
oServiziSingoli:setFilter( cFilter1)
oServiziSingoli:GoTop()
On edit I made
oBrw1:bEdit := { |oRec| EditServizi( oRec ) }
and on this function
- Code: Select all Expand view RUN
Function EditServizi( oRec )
local lAdd := ( oRec:RecNo == 0 )
local lSave := .F.
local oFont
local oBtn
local oDlg
local oBtnImage
local cFile :=""
local cDefaImage:="noImage.png"
Local cImage:= oRec:Image
Local oImage
local cImgPath:=".\images\"
local cId := strzero(oRec:RecNo,4)
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, 15
DEFINE DIALOG oDlg SIZE 422, 326 PIXEL ; //FROM 100, 100 TO 426,522;
TITLE If( lAdd, "New Service", "Edit Service" ) FONT oFont
@ 12, 10 SAY "Code:" OF oDlg SIZE 19, 8 PIXEL
@ 10, 46 SAY cID OF oDlg SIZE 85, 12 PIXEL
....
IF lSave
oRec:Multiple:=.f.
oRec:Image:= cImgPath+UrlImage(cImage)
oRec:Save( .T. )
ENDIF
But on add new I not see the code but only "0000"
after the edit save Id right
How I can to show the Id right on the dialog when the user edit a new record?
I use
local cId := strzero(oRec:RecNo,4)
But when I used the normal use to insert a new code I made
IF SE->(EOF())
cNumero := strzero(RecNo(),4)
ELSE
cNumero := strzero((VAL(SE->id)+1),4)
ENDIF
with tdatabase how I must make it ?