cancel
Showing results for 
Search instead for 
Did you mean: 

An identity column in a table

Former Member
0 Kudos

Hi,

We are trying to implement an identity column in a table on our VC Model. We have a data store that contains a counter value. On our table, we have created a toolbar that contains the "Add" button and the "Remove" button.

The "Add" button is assigned the system action "Insert Row" with the option "After".

The "Remove" button is assigned the system action "Delete Row".

I dragged from the output port of the table to the data store. I assigned the "delete" event to the data mapping line and entered the following formula

STORE@counter-1

I dragged from the output port of the same table to the data store. I assigned the "insert" event to the data mapping line and entered the following formula

STORE@counter+1

Both events originate from the "All events" category, and have the event scope "Source element".

When I compile and deploy the model, I find that I can insert rows to the table, but the identity column is always 0. I can remove rows from the table but since the identity column is always 0, I cannot tell if the decrement to the counter is working.

If I drag from the output port of the table to the data store and assign the "select" event, I find that after deploying the model, every click on the row will increment the identity for the row. Clicking on the "Remove" button will successfully decrement the counter by one. Clicking on the row again will increment the identity of the row correctly.

The question now is: Why did the Add button, which is supposed to be the insert row system action, did not increment my counter in the data store?

Please advise.

Edited by: Voon Siong Lum on Oct 10, 2008 10:57 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Resolved. Managed to handle identity column by using data store and the select event.