How to Insert Records Which are Checked in Multi Record Block [message #513792] |
Wed, 29 June 2011 07:28 |
|
goparaju
Messages: 54 Registered: June 2011
|
Member |
|
|
Hi Experts,
I am working on forms 6i.
I have datablock 'EMP', it's multi record block. I have a button 'CREATE', I have 'commit_form' in 'When button pressed' trigger, to commit records. It's working fine.
Now, i have a check box in the same block, i want to insert records which are checked only. Could anybody help me how to get this.
Thanks in advance.
|
|
|
Re: How to Insert Records Which are Checked in Multi Record Block [message #513796 is a reply to message #513792] |
Wed, 29 June 2011 08:00 |
cookiemonster
Messages: 13952 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You would have to create a button. In it's when-button-pressed trigger you would write some code to loop over the datablock using first_record/next_record and insert each record that is checked with an insert statement.
You would need to make the block a non-database block otherwise commit_form will cause all the other records to be inserted anyway.
|
|
|
|
Re: How to Insert Records Which are Checked in Multi Record Block [message #513809 is a reply to message #513806] |
Wed, 29 June 2011 08:42 |
cookiemonster
Messages: 13952 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You'll need to write code. and enter-query mode won't work. Non of the default processing works on non-database blocks.
And if the user exits the form it won't ask if they want to save changes.
There is one alternative - base the block on a procedure. You can have an insert procedure that takes all the items in the block and it can do an insert or not based on the value of the checkbox.
This also involves a lot of code but you'll get enter-query and asking to save on exit back.
|
|
|
|
|
Re: How to Insert Records Which are Checked in Multi Record Block [message #513860 is a reply to message #513814] |
Wed, 29 June 2011 13:41 |
|
goparaju
Messages: 54 Registered: June 2011
|
Member |
|
|
Hi Experts,
Thanks for your replies. Before main screen(EMP BLOCK) screen, i have 'FIND' window, which contains empno, ename. When i click FIND button, it will fetch data from EMP1 table (which of same structure of EMP table) and populates data in EMP block.
Now i will check records which ever needed,after clicking 'SUBMIT' button, only checked records should be inserted into EMP table.
If i follow to delete the unchecked records and click submit button, will it insert only checked records? In that case,as one of the replies mentioned that without clicking submit button if user clicks close window and 'save changes' yes, will it insert all records?
Could somebody provide me the feasible solution.
Thanks for your support.
Awaiting your responses.
|
|
|
|