Custom ID generation
Posted: Wed Oct 24, 2012 2:19 am
Hi All,
Thanks for the good work you are doing. I am coming from oracle psql background and am new to nuBuilder but found it to be very interesting to build applications with.
I have some application developed in Oracle Application Express but now want to port the applications into nubuilder. However, i was wondering how i could implement custom id or primary key generation.
I have a table named member as below:
memberid varchar2(10) primary key
mem_name
mem_dateofbirth
sex
In a form built on the member table in Oracle Express, i have a trigger attached to the member table which is then attached to the form so that upon saving records into the database table, it generates a custom id for each member. Here is the code:
if :NEW."MEMBERID" is null then
select TO_CHAR(SYSDATE,'YY')||'EPC'||LPAD(:NEW."ID",5,'0') into :NEW."MEMBERID"
from dual;
sample memberid
12EPC00001
12EPC00002
12EPC00003
.....
How do i implement this id generation concept in nubuilder?
The composition of the memberid is:
1st 2 characters stands for the year
the next three characters is a constant code "EPC" and the next 5 digits represents the serial number.
Kindly help me implement this concept in nuBuilder so i will be able to import all my data from oracle into nubuilder.
Thanks
Godwin.
Thanks for the good work you are doing. I am coming from oracle psql background and am new to nuBuilder but found it to be very interesting to build applications with.
I have some application developed in Oracle Application Express but now want to port the applications into nubuilder. However, i was wondering how i could implement custom id or primary key generation.
I have a table named member as below:
memberid varchar2(10) primary key
mem_name
mem_dateofbirth
sex
In a form built on the member table in Oracle Express, i have a trigger attached to the member table which is then attached to the form so that upon saving records into the database table, it generates a custom id for each member. Here is the code:
if :NEW."MEMBERID" is null then
select TO_CHAR(SYSDATE,'YY')||'EPC'||LPAD(:NEW."ID",5,'0') into :NEW."MEMBERID"
from dual;
sample memberid
12EPC00001
12EPC00002
12EPC00003
.....
How do i implement this id generation concept in nubuilder?
The composition of the memberid is:
1st 2 characters stands for the year
the next three characters is a constant code "EPC" and the next 5 digits represents the serial number.
Kindly help me implement this concept in nuBuilder so i will be able to import all my data from oracle into nubuilder.
Thanks
Godwin.