Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AUTOINCREMENT VALUE IN DW - HOW KNOW IT?

143 views
Skip to first unread message

Alejandro Delu

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to

Hi !
I've a problem in dw with identity column.
I'm working with master-detail where in the master datawindow the primary
key is a identity column and in the detail dw i need this value at moment to
update it !!!

How can i know the value of field that have the identity property? Because i
need it for set this value in the detail dw.

Thank you very much

Alejandro.
alejand...@siu.edu.ar

Paul Horan

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to

Hi,
We solved it this way: (We're on PB5.0.04, SQLA 5.5.04 thru ODBC).

In the UpdateEnd event of the master, do a GetItemNumber() on the identity
column. It should automatically be populated with the autoincrement value
that was assigned by the database. (If this isn't happening, that's another
issue to solve...)
Save that value into an instance variable.
In the UpdateStart event of the child, loop thru each row and evaluate the
status flag. If the row is NewModified! then do a SetItem of the instance
variable into the primary key of that row.

We developed an extension to our framework's version of the linkage service
(sorry, it's not PFC) that also handles many to many, i.e., multiple new
parents (grid or tabular style parent) linked with a child dw.

Paul Horan
VCI
Springfield, MA

Alejandro Delu <alejand...@siu.edu.ar> wrote in message
news:xmMtdV03#GA....@forums.sybase.com...

Terry Voth

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to

There's an attribute in the Update Properties dialog of the datawindow
painter called Identity Column. Select your identity column in there,
and PowerBuilder will automatically populate your identity column when
you do an INSERT. The only catch I've ever run into is that, if you're
using ODBC, you have to make sure the database type is defined in the
PBODB#0.INI file (where # is your PB version number... you don't
mention which one you're using).

Good luck,

Terry [TeamSybase] and Sequel the auto-incrementing techno-kitten

Alejandro Delu

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to

Thank you, but my problem continue.
In the master dw, I've MORE ONE ROW. Then in updateend event i can't know
all values of autoincrement values! understand you?
Because for each row of master dw, i need (once update the row) know value
of autoincrement column and set this in all row of detail-dw.

The problem is what PowerBuilder not populate the field autoincrement after
i did Update!!!

I'm working with PB 6.5 and Informix 7.30 (In informix the datatype
autoincrement is 'Serial', this is an integer datatype)


TIA

Alejandro Delu


Paul Horan

unread,
Aug 7, 1999, 3:00:00 AM8/7/99
to

Is the column in the Master selected as the IDENTITY column? Rows >> Update
Properties >> Identity dropdown.

This works just fine for us. After the Update() statement, every new row in
the Master has a unique value automatically placed in the identity column.
This is a configuration issue between PB6.5, Informix, and your datawindow.
Solving the Master/Child linking issue is something solved with
Powerscript... There may be something in the PFC linkage service that does
this, but we're not a PFC shop. We had to build that ourselves.

Our trick was to add a computed integer column AutoLink to each datawindow.
As the parent row is inserted, we generate a random number and SetItem that
into the master.AutoLink column. As each child is inserted, we copy the
value of AutoLink from the parent to the child. That keeps them linked.
In the UpdateStart event of the child, we find the row in Master that
matches on the AutoLink column, and do the SetItem of the master.Identity
column into the Child, where they match on the autolink column.

Paul

Alejandro Delu <alejand...@siu.edu.ar> wrote in message

news:Ff7$RWC4#GA....@forums.sybase.com...

0 new messages