Re: generate primary key
Jason Cater <[email protected]>
| Newsgroups | gmane.comp.gnu.enterprise.general |
|---|---|
| Organization | GNU Enterprise |
| Message-ID | <[email protected]> |
Here is an example out of one of my forms:
<field name="fldId" field="id" typecast="number">
<trigger type="PRE-INSERT" name="fldId_PreInsert"><![CDATA[
# Set default value
if self.isEmpty():
self.autofillBySequence('order_seq')
]]>
</trigger>
</field>
order_seq is the sequence name. Designer adds this trigger automatically if
dragging from the Schema Navigator to the Layout Editor.
-- Jason
On Thursday 03 June 2004 03:30 pm, Erik Dalén wrote:
> Hi
>
> I'm wondering how you make a Pre-Insert trigger on a field that
> generates a new unique number for that field? For a numeric primary key
> in a SQL table. Should be a quite common thing in 2-tier apps.
>
> /Erik
>
>
> _______________________________________________
> Gnue mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/gnue