Home » Developer & Programmer » Forms » issue with list item (forms 10g)
issue with list item [message #413155] Tue, 14 July 2009 11:31 Go to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
i have 2 blocks called block_A and block_B .

block_A is based on table_A, block_B is based on table_B.

block_A is the first block on the canvas.

there is a list item on block_B which is database item means based on table_B.

this item is present on the block_A on the canvas.

block_B is child to block_A.

now problem is,

when i open the form then the initial value of list item is 'N'. it has to be inserted in the table_B.

but its inserting in table_B only when i change the list value and SAVE.

in when-new-form-inst trigger i wrote a code such that it inserts the value of list item in the table_B.

its working, it inserts when the form is opened.

but when i change the value of list item it shows error :
unique key constraint violated.

my understanding is as this is a database item, when i change the list value for the first time, it is inserting the value of ID which is primary key in table_A and foreign in table_B. but ID already exists as i inserted in when-new-form-inst trigegr.

if i make it a non database item i can easily solve problem, but i want to have it a database item only. and it should be inserted with value when form is opened and it should get updated when list changed.

to update the item, in when-list-changed trigger i wrote below code:

declare
l_count number;
begin
select count(*) into l_count from table_B 
where ID=:block_A.ID;
if l_count=1 then
update table_B
set list_item=:block_B.list_item
where id=:block_A.ID;
end if;
end;


even though its not working.

what can be done?

thanks
jillu
Re: issue with list item [message #413198 is a reply to message #413155] Tue, 14 July 2009 14:20 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
i want to add few more things.

when i open the form then the initial value of list item is 'N'. it has to be inserted in the table_B.

instead of above thing,

when a new record is created in block_A, list item has to be inserted in table_B.

in when-new-record-inst trigger of block_A, i wrote

:block_B.list_item:='N';
commit_form;

for the above code, it shows some business related message that "cannot be saved here".
but if i click on save button, its saving to the table_B.

i dont know why is it not saving for commit_form but saving for save button.

instead of using commit_form, i used POST . even though same problem.
Re: issue with list item [message #413625 is a reply to message #413198] Thu, 16 July 2009 15:45 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
any help is appreciated
Re: issue with list item [message #413633 is a reply to message #413155] Thu, 16 July 2009 17:14 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'd come up with a new design that doesn't involve use of this list item personally - it just sounds really difficult to implement.

As for this
Quote:

for the above code, it shows some business related message that "cannot be saved here".
but if i click on save button, its saving to the table_B.

i dont know why is it not saving for commit_form but saving for save button.


Have you checked to see if there's any code in the KEY-COMMIT trigger?
Re: issue with list item [message #413772 is a reply to message #413633] Fri, 17 July 2009 10:51 Go to previous messageGo to next message
nastyjillu
Messages: 211
Registered: February 2009
Senior Member
yes. there is a code in key-commit.

actually, i come to this form through other form. that is the way to generate itm_id in block_A.
so whenever a itm_id is generated, it posts data in the table_A. so in key-commit trigger, code looks for rowid in that table. if rowid doesnt exists it allows me to save.
but if rowid exists it doesnt allow me.

so commit_form is not working here because rowid already exists.
but there is a status change in form as iam assigning value to list_item. then why cant i commit using commit_form.?

this is gonna be difficult one
Re: issue with list item [message #413856 is a reply to message #413155] Fri, 17 July 2009 17:56 Go to previous message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
It's checking rowids?
Huh?!?

That's a really bizarre way to prevent updates, what's wrong with setting the block to update_allowed false?

As for your general inability to save - you say you're getting a custom error message - well find it in the code and work out why it's there.

It sounds like you're trying to bypass a lot of code that is presumably there for a reason. You really need to work out what that code does and why it does it before you go altering it.
Previous Topic: Want to create a pll
Next Topic: Unable to locate record in Block
Goto Forum:
  


Current Time: Mon Feb 10 04:30:34 CST 2025