I have to provide two text fields- Origin(this will show a default value which is BHR), Destination (user will input) and there will be a Add button which user will click , so i have to put a validation on an add button to check the origin and destination values exits in the table , If value exits in the table - it will find the max value of this column - SerialNum(suppose in table the max of the
serialNum is 10 then it will take this value and increment it by one which is 11 ) and then a form will appear to the user which will have some prepopulated values
Refer below and advise -
1- How to add validation to find Max value of serialnum and then increment it by 1 and then the incremented value is shown in the form(prepoulated) - As follows-
Suppose user input - BHR and Destination(JHS) -then click on - Add button ( a validation process will start - it will search in the table if ABC and BHR exists in table- suppose they exits
'ABC','BHR','JHS',10,240,120,'3601',1115,0,'FFF',0
'ABC','BHR','JHS',11,2400,120,'3602',1115,0,'FCF',0
- Now in these 2 records it will find the max serialnum - from above btw 10 and 11 - it will store the max value in a variable which is 11 , after this it will increment this value by 1 and and a form page will open - with some prepopulated fields also the incremented value of the serialnum-
CompanyName Origin Destination SerialNum(non editable by user),startmin,msgTRG,traino
ABC BHR JHS 12 userinput all three
And then click on Save Button - all the details get's inserted as a new record in table )
2- How to show the form fields when clicked on add button-where user will input few values and when click on save button it should insert the value -
Insert into t1 (Code,origin,destination,Serialnum,StartMin,MSGTRG,trainNo,TrainCarrier,trainSEQNUM,MSGTYPE,TAGID) values
('ABC','BHR','JHS',12,240,120,'3601',1115,0,'FFF',0);
Please check and advise how to implement this scenario using oracle apex 4.2 or above.
Thanks