Home » Developer & Programmer » Forms » coding problem
coding problem [message #255112] Mon, 30 July 2007 12:17 Go to next message
srinivas.k2005
Messages: 404
Registered: August 2006
Senior Member
Hi,

I have a requirement to show the address of the customer.
I have name, address1,phone,city on the screen and three radio buttons.
1 radio button named as current address
2 radio button named as current previous address
3 radio button named as current mailing address.

When i change the radio button i have written execute query, to query according to the address.
If i click on current address radio button ,it will show only the current address, similarly for others.
There can be many previous and mailing address.
But only one current address.

When the user changes the current address , we will popup a message asking user that the before changed address will be moved to previous address. if the user clicks yes the i should move the before address to previous address.

I am facing problem in executing my logic can somebody give me a best logic.

Thanks,
Srinivas

[Updated on: Mon, 30 July 2007 12:18]

Report message to a moderator

Re: coding problem [message #255194 is a reply to message #255112] Tue, 31 July 2007 00:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I would suggest having another set of non-database items in your block and populate them in the Post-Query trigger.

You have 'name', 'address1', 'phone', 'city'. I would create 'old_name', old_address1', 'old_phone', and 'old_city' in the block.

In the Pre-Update trigger for the block you could have the following code:
begin
  if    :blk.name <> :blk.old_name
     or :blk.address1 <> :blk.old_address1
     or :blk.phone <> :blk.old_phone
     or :blk.city <> :blk.old_city then
    insert into prev_addr
                (name, address1, phone,
                 city)
         values (:blk.old_name, :blk.old_address1, :blk.old_phone,
                 :blk.old_city);
  end if;
end;

David
Re: coding problem [message #255555 is a reply to message #255112] Wed, 01 August 2007 03:36 Go to previous messageGo to next message
srinivas.k2005
Messages: 404
Registered: August 2006
Senior Member
Thanks,
But if i do it in this way i am getting duplicate record error.
Here Address is unique.
If i write it in pre update:

Before updating the existing record it starts inserting and i will get unique constraint voilated.

I will try the same with post-update,but once i save the record.
It is not allowing me to query or change.
It is poping up saying requery or you cannot change this record

Srinivas
Re: coding problem [message #256061 is a reply to message #255555] Thu, 02 August 2007 21:10 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please list names of tables that you are using.

David
Previous Topic: to diplay on form
Next Topic: Date problem in Email
Goto Forum:
  


Current Time: Thu Dec 05 17:07:51 CST 2024