Home » Developer & Programmer » Forms » To copy data from one datablock to another (Oracle 10G)
To copy data from one datablock to another [message #557966] Mon, 18 June 2012 06:18 Go to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Hi,
I am developing an application for making the travel entries for my organization employees.

For that purpose I have 3 datablocks named:
1) Travel header
2) Employee Detail
3) Travel Detail
which are interlinked through constraints.

I want to give 2 options ie. either single booking entry or Group booking entry.
The form is working properly for single booking entry. But when I want to make a group booking wherein many employees have to travel between common locations I have to fill all the travel details again for all employees. I want to avoid that since it wont give a feasibility for this application.
Can you give me any idea through which I can copy the travel details I have entered for the 1st employee. I am uploading the form layout. Please have a look and suggest me any idea which can help me to make group booking.
  • Attachment: scrn_shot.JPG
    (Size: 71.70KB, Downloaded 931 times)
Re: To copy data from one datablock to another [message #557969 is a reply to message #557966] Mon, 18 June 2012 06:30 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Are employee details and travel details blocks master-detail blocks? If so, I don't know how to do what you are asking. Because, as soon as you switch to another employee, travel details block will be emptied, waiting for you to enter new values.

Perhaps you could create a view (join employees and travels) and create a form based on that view. A form record would then contain all information in the "same line". That record might be rather long, so you might need to create a stacked canvas (which offers a horizontal scrollbar).

After entering values for the first employee, you'd navigate to the next record and (either by shortcut keys or form menu) "duplicate record". Of course, you'd modify values related to an employee, while travel information would remain the same.

Do inserts, updates and stuff with INSTEAD OF triggers.

Hopefully, someone else will have a better and simpler idea.
Re: To copy data from one datablock to another [message #558071 is a reply to message #557969] Tue, 19 June 2012 04:21 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Thank you sir for giving the hint. Lets see if I can try out. I have taken a stack canvas which pops on clicking over group radio button.The items on this canvas is as same as travel detail canvas and the data gets stored in dummy block which is not a database block having no relation with prior two blocks because of which atleast the block does not gets cleared if I am adding another employee in employee detail block.
Now the problem occurs on saving.
How can I save this form because on saving data gets posted on 4 tables. Travel header, Employee Detail, Travel Detail and Travel Advance table.
How can I again create relations among data which I have entered i.e. the travel details should go same for all the employees which I have selected. Can anyone suggest some idea over this. Might be little tricky but some method or is there any function available in forms through which I can copy the entire block records again for different employee.
Can I use duplicate_record builtin? If yes, How? reply awaiting. Thanks.
Re: To copy data from one datablock to another [message #558437 is a reply to message #558071] Fri, 22 June 2012 02:12 Go to previous message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Well I got a solution over my problem. Whenever I am inserting a new travel detail, the record is geting inserted in a global temporary table. Now when I am adding a new employee it prompts a message "Wether you want to duplicate the record", as i click on yes, I am retrieving the data from global temporary table through a cursor.
But the problem I am facing here is , if there are 2 travel details, the cursor is fetching those 2 details but the pointer is comming to the next record which is blank, hence evrytime I have to click on delete button to delete that row and then keep on adding new employees.
In the end of the cursor I do wrote first_record. By using this, I am not getting that blank record but whenever I adding a new employee though a list, it is getting replaced by the previous employee detail i.e the 2nd record of employee detail is getting overwritten.
How can i built this flow in a proper way.
please sugest some idea.
thanks.
Previous Topic: What is the code to get the label of radio button ?
Next Topic: one column show two field also update
Goto Forum:
  


Current Time: Fri Jul 05 22:17:36 CDT 2024