Blank line getting generated on save button [message #585980] |
Fri, 31 May 2013 12:03 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/a6b6cc0f116389c1f6a3eba6b559f71a?s=64&d=mm&r=g) |
danrahul
Messages: 2 Registered: May 2013
|
Junior Member |
|
|
Hello friends,
I am working on Oracle forms 6i.
I am getting a problem when I am trying to save the value in the form.
Well the scenario is like this:
I have got a multi record block. In that block there are two items jobno and inoivce no. Both the items have an LOV attached to them giving jobnos and invoice nos respectively.
This is on the '*ORIGINAL_BLOCK*'.
The problem perists with the jobno field. In the LOV for jobno, the 'column mapping properties' property, the return item section has original_block.jobno as the value. The code to fetch the details about the jobno (like vendor no,vendor site,invoice no etc) has been written on the When-Validate-Item trigger. I am also updating the WHO colums(like created by,created date,last upated by, last update date) on the Pre-Insert trigger at the block level. This whole thing of fetching the records is working fine. But when I simply press the save button an extra blank line gets generated on the form as well as at back end with jobno like this:
Sr.no JOBNO vendor_no vendor_name invoice_no invoice_date
1 123 37456 abc 4564565 26-APR-2013 --- correct entry
2 123 8574 xyz 645656 26-JAN-2013 --- correct entry
3 123 --- --- --- --- unrequired blank entry
A same jobno can have multiple number of invoices. So the lines getting generated are - number of lines + 1(unrequired entry).As in the above scenario there are only 2 invoices for the same job and a third unrequired entry getting generated. If there are 3 invoices I get 4 lines (3 required + 1 unrequired blank entry).
So to solve this issue I added a button 'Add JOB'. I took another '*NEW_BLOCK*',designed another canvas and and added an item on it containing a dummy jobno field and attached an LOV to that item. Then the same When-Validate-Trigger to that item fetching the details. so when I press the button 'Add JOB' using show_canvas and go_item(dummy_job_item) I navigate to that new canvas, select the jobno there from LOV, fetch the details. Now I wrote execute_query on KEY-EXIT of the NEW_BLOCK so that whatever are the fetched details, they would go on the ORIGINAL_BLOCK.jobno and respective details in resp fields. But this did not work.So I wrote execute_query on the When-New-Block-Instance of the ORIGINAL_BLOCK and it worked.
But now what is happening is when I open the form once again after closing the form, all the back end data is appearing on the form i.e. when I open a new form session everytime. But I want the form to be clear with no entries displayed whenever I open the form.
I understand the question is lengthy and tricky. Apologies for that. But had to elaborate it, to get across the problem.
[EDITED by LF: applied [code] tags]
[Updated on: Fri, 31 May 2013 12:14] by Moderator Report message to a moderator
|
|
|
Re: Blank line getting generated on save button [message #585981 is a reply to message #585980] |
Fri, 31 May 2013 12:20 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Workarounds you described in the last two paragraphs, in my opinion, shouldn't have been done at all. Besides, they seem to be far to complex to solve a problem you described. You have to find what creates that extra record and prevent it from happening.
List of values doesn't create any records (by the way, why don't you select all details (vendor, invoice, etc.) in LoV? It doesn't matter that LoV is on the JOBNO item - you can still fill other items. By the way #2, WHEN-VALIDATE-ITEM isn't wrong; just remember to put the same code into POST-QUERY trigger so that these items get filled when you execute query; of course, that's valid only if these items aren't based on database table columns).
WHEN-VALIDATE-ITEM trigger either.
What does the PRE-INSERT trigger do? I doubt that it creates a new record (as you can't use restricted procedures, such as NEXT_RECORD and similar) in there.
Do you have any other (block-level?) triggers on that block? If so, what do they do?
Unfortunately, you aren't on Forms 10g which contains debugger so you'll have to put MESSAGE built-ins into your triggers in order to follow form execution and find what causes the problem.
|
|
|