other of Tdatarow of fwh

other of Tdatarow of fwh

Postby Silvio.Falconi » Mon Feb 04, 2019 3:55 pm

Image

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 ?
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: other of Tdatarow of fwh

Postby James Bott » Mon Feb 04, 2019 7:40 pm

Technically it is not a new record until it is saved.

If you assign a new ID before it is saved, then you end up having to delete it as you have been doing. This creates problems. Why do you think the user needs to see the ID?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: other of Tdatarow of fwh

Postby Silvio.Falconi » Tue Feb 05, 2019 8:14 am

The answer is not relevant to the question.

Technically it is not a logical thing not to show the code number that in this case is called "ID" or it can also be called in another word like "codart" or "coditem"

What does it mean that the end user sees or does not see the code when he add a new record ?

Certainly the user must see the code that is inserted,
it is a logical thing,
as I told you so many times, you James have a way to do the programs other than as I unfortunately have to do,

I can not upset the program because James he sad me not make it...

Are we joking ?
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: other of Tdatarow of fwh

Postby Silvio.Falconi » Tue Feb 05, 2019 1:47 pm

ok Now I erase ID no need, If I cannot see it...
If my client hits me I'll tell him it was James, I was not involved
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: other of Tdatarow of fwh

Postby James Bott » Tue Feb 05, 2019 5:09 pm

As I mentioned, there is no ID on a new record data entry screen because the record doesn't yet exist. It only exists AFTER the user saves it.

If you assign ID's before the record exists, then you have to delete the blank record when the user Cancels instead of Saves. When you were writing code for only a single user this was not an issue, but with multiusers you cannot then open the file in exclusive mode, and pack the database each time a user cancels.

Users will be able to see the ID in the browse immediately after saving the record. Most users don't care about IDs anyway. ID's are mainly used to lookup records by the software.

Also you need to set all the ID fields in all you data entry dialogs to READ ONLY. You can't allow users to edit the IDs.

I know you are upset because you can't do everything the way you used to, but this is a price you have to pay to develop multiuser applications.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: other of Tdatarow of fwh

Postby Silvio.Falconi » Tue Feb 05, 2019 6:14 pm

I think it is wrong.
If i made a multiuser application i cannot see the id ?
You are joker...
But i am Batman
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 49 guests