main logo
Subject: Sequential Nos. (was BizObj Partiality to Default Values)
Author: Bhavbhuti Nathwani
Posted: 2001/11/09 14:01:41
 
View Entire Thread
New Search


Hi all,

Getting inspiration from one of my previous threads this is what I have written for generating sequential nos. in a CB form. Please provide me with suggesstions however critical they may be, being a starter I will welcome experienced insights.

Properties:
- Method:
- AfterNew:
LPARAMETERS tnRetVal

DODEFAULT()


THISFORM.txtiPONo.VALUE = CBNewID("IPONO")
REPLACE NextPK.cValue WITH transform(THISFORM.txtiPONo.VALUE, " (at) L 9999999999")


RETURN tnRetVal
- BeforeSave:
DODEFAULT()


LOCAL liPONo

liPONo = CBNewID("IPONO")

IF THISFORM DOT txtiPONo.VALUE # liPONo
REPLACE NextPK.cValue WITH TRANSFORM(liPONo, "@L 9999999999")

IF MESSAGEBOX("Purchase Order no. " + ;
TRANSFORM(THISFORM.txtiPONo.VALUE, "9999999999") + ;
" has now been assigned during your data entry session." + ;
CHR(13) + "Would you like to assign the next available no.", ;
4+32+0, "No. already assigned") = 6

THISFORM.txtiPONo.VALUE = CBNewID("IPONO")
ELSE
RETURN .F.
ENDIF
ENDIF


RETURN .T.


I feel that in true multi-users terms it may bomb out and I hate updating NextPK. How about the community proposing a function similar to CBNewID() but with the options similar to above usage.

I feel the need for sequential numbers is true and as far as my experience is concerned almost all my form have it. Internally I am still opting for cID but this is just for the user viewing satisfaction.
Regards
Bhavbhuti
 
©2001 Bhavbhuti Nathwani
<-- Prior Message New Search Next Message -->