Home » Developer & Programmer » Forms » Adding a Save (Update) button (Oracle Forms 6i)
Adding a Save (Update) button [message #571622] Wed, 28 November 2012 03:57 Go to next message
marko.trajkoski
Messages: 8
Registered: October 2012
Location: Slovenia
Junior Member
Hello Everyone!

Here is my problemm..

I have one form where I have let's say 2 items that I want to manage. One is a List Item and the other Text Item. Both are based on one table. The List Item is not updatable (Update Allowed is set to NO) and there I have some types of houses for example (T -> tall house, B -> Big house, S -> Small house it's not important so much) and the Text Item is for counting the types for example we have 4 houses of type T and if we add another one in the textItem we will see 5, so it's not counter for all houses but it counts types of houses and that item is not updatable nor insertable (Update allowed and Insert allowed are set to NO) so it's only purpose is just to show how many hauses we have of particular type and automatically increases the number if we insert new house.
Beside this two items I have another Items that conatin some informations about the house (How many flats, doors, windows, and so on..).
I hope you've got the picture of my form and table. Smile

Now I want to add one button with trigger WHEN-BUTTON-PRESSED that will do this..
If I want to change the type of the house after I inserted it and save it in the table, I have to just change the type in the List Item (choose another type) and press the button to save the same house with the same properties I would say (How many flats, doors, windows, and so on..) but with another type. First when I press the button it must ask me if I am sure that I want to make that change (I'll make an allert fot that) and if I press OK or Yes my house will be saved just with the different type and the previous house with the previous type must be erased. And in the textItem 'the counter', the number of the new type must encrease for one and the previous type must decrease for one.

I hope you understand what I want to do and all I need is that trigger to manage this problem of mine. I know it's possible to do but I am quite new in DB programming and I am not very good with programming in PL/SQL.

Please correct me if my idea of doing this is incorrect and give me some instructions.

Thank you all!
Re: Adding a Save (Update) button [message #571631 is a reply to message #571622] Wed, 28 November 2012 06:16 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
You haven't really explained if this action should result in an update statement, or an insert and a delete.
What is the primary key of the table?
Re: Adding a Save (Update) button [message #571632 is a reply to message #571631] Wed, 28 November 2012 06:24 Go to previous messageGo to next message
marko.trajkoski
Messages: 8
Registered: October 2012
Location: Slovenia
Junior Member
I think this action should result in an update statement. So there is no need to erase the previous and then insert the new one.
Primary key is another value.
I wrote this as an example, the table I am working on is not this one.. I didn't use as an example the real table because it's in Slovenian and neither I won't be able to explain the meaning of every item. Sad
Re: Adding a Save (Update) button [message #571633 is a reply to message #571632] Wed, 28 November 2012 06:39 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then you need to translate the column names into english for the rest of us.
It's very hard to visualize what update is required if we don't know the relationship between the datablock items and the database columns.
Re: Adding a Save (Update) button [message #571634 is a reply to message #571633] Wed, 28 November 2012 06:45 Go to previous messageGo to next message
marko.trajkoski
Messages: 8
Registered: October 2012
Location: Slovenia
Junior Member
OK, I thought that, it won't be nececary because all I want is that trigger that makes an update on a table (on those two particular items).
I'll try to translate everything, how it works now and what I really want to add.

Thank you!
Re: Adding a Save (Update) button [message #571641 is a reply to message #571634] Wed, 28 November 2012 07:50 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Any forms trigger will make an update on the table if you write an update statement in it.
And you seemed to want to use when-button-pressed - so not sure why you're asking about what triggers to use - that would be the trigger.
Unless you want to use forms default behaviour, in which case you probably don't want the button, but instead put the required code in pre-update. Your problem description is too vague to guess what that code might be.
Re: Adding a Save (Update) button [message #571646 is a reply to message #571641] Wed, 28 November 2012 08:10 Go to previous message
marko.trajkoski
Messages: 8
Registered: October 2012
Location: Slovenia
Junior Member
I'll try myself to manage this problemm.

Thank you!

Previous Topic: set the value of variable with parameter
Next Topic: How can I display dynamic LOV ?
Goto Forum:
  


Current Time: Wed Apr 24 23:58:12 CDT 2024