Home » Developer & Programmer » Forms » Update from Non Database item (Forms 6i)
Update from Non Database item [message #446545] Tue, 09 March 2010 04:57 Go to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

I am preparing a query form based on one view.it will return the result set based on parameters passed.What i need is i will add 3 non database item in entry mode along with result set.Once the user inputs these 3 fields in non database fields , it should update the relevant records mapped to it in database table. How to do this.

Re: Update from Non Database item [message #446548 is a reply to message #446545] Tue, 09 March 2010 05:15 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
With the UPDATE statement. Something like
update your_table set
  first_column   = :block.first_non_database_item,
  second_column = :block.second_non_database_item
where some_column    = :block.some_item
  and another_column = :block.another_item
Re: Update from Non Database item [message #446549 is a reply to message #446545] Tue, 09 March 2010 05:23 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
Simple way - add a button that users will need to press to do the update. Write all code to do necessary update(s) in that.

More complicated - base the block on a procedure. This way means that the block behaves as a standard data block as far as the users are concerned - no special buttons to press.
Re: Update from Non Database item [message #446551 is a reply to message #446549] Tue, 09 March 2010 05:25 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Thanks cookiemonster but instead of writing one button i will write the update statement on when_validate_item trigger is it ok.
Re: Update from Non Database item [message #446552 is a reply to message #446548] Tue, 09 March 2010 05:26 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Dear Littlefoot can i add
the update statement on when_validate_item trigger is it ok.i mean on non database field when validate item.

[Updated on: Tue, 09 March 2010 05:26]

Report message to a moderator

Re: Update from Non Database item [message #446553 is a reply to message #446545] Tue, 09 March 2010 05:30 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you've got three items and you use WVI then you're going to need to put a WVI trigger on each item and then have the update in each. Which means that:
a) you could update the row three times - once for each item
b) some of the time you'll be updating columns to null when you don't really want to - since the values won't have been filled in yet.

Not a good idea.
Re: Update from Non Database item [message #446554 is a reply to message #446553] Tue, 09 March 2010 05:32 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

then what will i use , give me your recommendations sir.Shall i use key_next_record otherwise give me your suggestion step by step
Re: Update from Non Database item [message #446557 is a reply to message #446554] Tue, 09 March 2010 05:53 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As you didn't tell (so far): why did you create a table on a view? Why didn't you use a table as a data source? Doing so, you'd simply overwrite old values (i.e. do the update directly in a form). No additional code is needed in that case.
Re: Update from Non Database item [message #446563 is a reply to message #446557] Tue, 09 March 2010 06:05 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Actually sir its like i am querying from the two tables and i want to update one table out of those 2.
like i have two tables.
ot_po_head
ot_po_item

link between them is ot_po_head.ph_sys = ot_po_item.pi_ph_sys

Our user want to view the data from both ot_po_head and ot_po_item and wants to edit ot_po_item.
Re: Update from Non Database item [message #446565 is a reply to message #446545] Tue, 09 March 2010 06:09 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why not just have a standard master-detail form - two blocks?
Re: Update from Non Database item [message #446566 is a reply to message #446565] Tue, 09 March 2010 06:11 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Actually they will not update one record one time.Like they will pass input parameter like from po to po and this will list out all the(items) records pertaining to those po's and they will enter whichever they want.
Re: Update from Non Database item [message #446568 is a reply to message #446566] Tue, 09 March 2010 06:17 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK then; push button + UPDATE statement.
Re: Update from Non Database item [message #446570 is a reply to message #446568] Tue, 09 March 2010 06:19 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

what if user fails to click on the push button.
Re: Update from Non Database item [message #446572 is a reply to message #446570] Tue, 09 March 2010 06:23 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What if he/she fails to turn on the computer?
Re: Update from Non Database item [message #446573 is a reply to message #446545] Tue, 09 March 2010 06:24 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then the update won't happen.

If you want it to behave as a normal datablock then you need to base the block on a procedure rather than a view.
Re: Update from Non Database item [message #446575 is a reply to message #446572] Tue, 09 March 2010 06:25 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

I am sorry , Please dont take me in a wrong way jus a suggestion and i have one idea , why not put one check box if he enters one of those 3 fields and update only those fields which have checked mark checked.
Re: Update from Non Database item [message #446576 is a reply to message #446573] Tue, 09 March 2010 06:27 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

i havent done any form based on proceedure.can you explain me how to approach it please or please give me some sample form.
Re: Update from Non Database item [message #446577 is a reply to message #446575] Tue, 09 March 2010 06:30 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I was just kidding (kind of); there is not only one way to do that - choose whichever you want.

If the requirement is that all three non-database items must be entered, then make sure it happens.

If the requirement says that user has to confirm that everything is OK, then perform that kind of validation.

If you want to use a checkbox, do it.

If you want to see how the "push button" option works, try it.

The whole story doesn't seem to be that complicated - test all options and choose the best one (from your and users' point of view).
Re: Update from Non Database item [message #446579 is a reply to message #446577] Tue, 09 March 2010 06:36 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Thank you i will try to do it
Re: Update from Non Database item [message #446941 is a reply to message #446579] Thu, 11 March 2010 00:48 Go to previous message
athar.fitfd@hotmail.com
Messages: 193
Registered: October 2007
Location: pakistan
Senior Member
Got this one really interesting .
Previous Topic: Fields disappear/hide after pressing execute query
Next Topic: Forms 6i : DBMS_WRITE ORA-00600 (merged by CM)
Goto Forum:
  


Current Time: Thu Dec 08 02:38:56 CST 2016

Total time taken to generate the page: 0.17473 seconds