main logo
Subject: Re: BizObj Partiality to Default Values
Author: Ed Leafe
Posted: 2001/11/05 19:09:47
 
View Entire Thread
New Search


<i><font color="#663300">In my PO form I have a PO no which has a number autogenerated everytime a new PO is added. I had specified the default value CBNewID("PONO") in the view of the table and the Form show the next no. well. Now I have shifted the defauklt value CBNewID("PONO") into the Table using modify structure. Now the form has stopped showing the next no. and as soon as the record is saved it does get the assigned next no.</font></i>

What you need to do is to add that functionality to the OnNew() method of the bizobj. Look at the cBizobj.OnNew() method for the technique Codebook uses to pre-fetch the next ID for the primary key field; you can then apply that coding logic to your bizobj's OnNew() to get the next PO. Be sure not to forget the DODEFAULT() call, or your bizobj will suddenly lack PK values.

<i><font color="#663300">Is it possible/advisable to keep the CBNewID() in the Table and not in the view and if so how do I show the next no. in the form and yet provide for the user clicking Revert and the next no. not being wasted.</font></i>

Ah, that's another matter entirely. Codebook PK generation assumes that the only requirement is uniqueness; sequential values are irrelevant. You'll have to code that logic yourself to match your business needs. For instance, you can always store "reverted" keys in a table, and look there before generating a new value, but then you have the problem that a PO generated later on may have a PO number lower than an earlier PO. If this isn't a problem, great; if it is a problem, you'll have to come up with a compromise that is acceptable to the business.


<font color="#cc0000"> ___/
/
__/
/
____/</font>
Ed Leafe
 
©2001 Ed Leafe
<-- Prior Message New Search Next Message -->