Home » Developer & Programmer » Forms » inserting unique id against each record
inserting unique id against each record [message #132951] Wed, 17 August 2005 00:18 Go to next message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
i hve a field list_id in a table(child) which is the primary key as well.
i m not displaying it on the canvas. where as i m inserting multiple records and click the save button at once n using commit_form. how can i insert the unique list_id agaist each id in the database.
list_id is going to be the unique number which will always b inserted against each record.n the number series will go on n on.
Re: inserting unique id against each record [message #132955 is a reply to message #132951] Wed, 17 August 2005 00:47 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Add a Pre-Insert trigger and if the :block.item_seq is null then select the seq.nextval into :block.item_seq.

David
Re: inserting unique id against each record [message #132958 is a reply to message #132955] Wed, 17 August 2005 01:09 Go to previous messageGo to next message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
martin
i can create the sequence n then the insert statement at the database level trigger...this is wat u hve told me.
but i mentioned wat if i want to do this with commit_form at the save button.
where to apply pre_insert_trigger..
Re: inserting unique id against each record [message #132959 is a reply to message #132958] Wed, 17 August 2005 01:16 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What I said was "Add a Pre-Insert trigger and if the :block.item_seq is null then select the seq.nextval into :block.item_seq."

What that means is IN THE FORM "Add a Pre-Insert trigger" to the block with the records you are adding, "and if the :block.item_seq is null then select the seq.nextval into :block.item_seq."

This FORM trigger (there is no Pre-Insert trigger in the database, there is a Before Insert) will fire for each row and if there is no seq number then one will be fetched for it.

David

[Updated on: Wed, 17 August 2005 01:16]

Report message to a moderator

Re: inserting unique id against each record [message #132960 is a reply to message #132959] Wed, 17 August 2005 01:19 Go to previous messageGo to next message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
hey david thanx
but just one more thing.
this item_seq is the sequence which i will hve to create which incremenets by 1...sor i dont hve to create n e sequence n it will work? coz next.val is used in sequence case
Re: inserting unique id against each record [message #132966 is a reply to message #132960] Wed, 17 August 2005 01:51 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I'm sorry I don't understand ... please ask again in full English.

David
Re: inserting unique id against each record [message #132968 is a reply to message #132966] Wed, 17 August 2005 01:56 Go to previous message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
HEY THANX DAVID.
i tried it b4 getting ur this last reply..
ur second last reply worked out
thanx
Previous Topic: creation of text file of form
Next Topic: How to display forms runtime icon on system tray
Goto Forum:
  


Current Time: Thu Sep 19 23:15:21 CDT 2024