Monday, July 6, 2009

Autoincrement a Field

The problem: automatically incrementing a numeric field. The Row ID should show up for each new row as it is created. Peoplesoft likes to use a system table to autoincrement, this seems unnecessary for a stand alone page.

I tried using the delivered function GetNextNumber and it's siblings. These seemed to work some of the time, but break if I deleted a row.

My solution:

/* In the rowinit event for the field we want to autoincrement. Set the field property to display only. */
If None(MY_REC.MY_ID) Then
MY_REC.MY_ID = GetRowset().ActiveRowCount
End-If;


From my testing, this has worked flawlessly.

No comments:

Post a Comment

Integration broker message going to done with no action

If IB messages are just going straight to done without running the handler, it can be corrected by regenerating the routings on the service ...