Master/Detail: Cascade Update just work for only one update?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

Master/Detail: Cascade Update just work for only one update?

Post by mpol_ch »

Hello
I have a master/detail table for use of cascade update and cascade delete. Cascade Delete is working with no problems. But the cascade Updating is not working.
I have six fields as key between master and detail.

It is just work for only one update. It means it changes only one record of detail table. Before change it shows correctly all the detail table records for exp. 6 or 14...

What could be the reason?
thanks

mpol_ch


danielc
User
Posts: 1601

Post by danielc »

I try a simple one master/two details project with cascade update enabled. Once master record updated and detail records will modify as well.

Please describe in detail which fields you have updated in your master record and which fields have issue to update in detail record?

Post your table schema and your master/detail setup for discussion.


mpol_ch
User
Posts: 877
Location: Switzerland

Post by mpol_ch »

Hello

Hello I am updating the rows Code, Vom, Bis. For the Monat and Jahr am using the following code to generation the Month and Yeas from "Bis". After Edit the table loehne I lost the relation to detail table "lohnpositionen"....

Here are the detail of my problem regarding to "cascade update"

Master Table: loehneerstellen
Detail Table: lohnpositionen

CREATE TABLE IF NOT EXISTS loehneerstellen (
Id int(11) NOT NULL AUTO_INCREMENT,
Code int(11) NOT NULL,
Vom date NOT NULL,
Bis date NOT NULL,
Monat enum('1','2','3','4','5','6','7','8','9','10','11','12') NOT NULL,
Jahr varchar(4) NOT NULL,
Datum date NOT NULL,
Bemerkungen varchar(255) NOT NULL,
CName varchar(20) NOT NULL,
UName varchar(20) NOT NULL,
CIP varchar(40) NOT NULL,
UIP varchar(40) NOT NULL,
CDate datetime NOT NULL,
UDate datetime NOT NULL,
PRIMARY KEY (Id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

CREATE TABLE IF NOT EXISTS lohnpositionen (
Id int(11) NOT NULL AUTO_INCREMENT,
Code int(11) NOT NULL,
PId int(11) NOT NULL,
RefId int(11) NOT NULL,
Datum date NOT NULL,
Vom date NOT NULL,
Bis date NOT NULL,
Monat varchar(2) NOT NULL,
Jahr varchar(4) NOT NULL,
Num int(4) NOT NULL,
Art varchar(80) NOT NULL,
Flag char(2) NOT NULL,
Prozent decimal(6,2) NOT NULL,
Menge decimal(10,2) NOT NULL,
Ansatz decimal(10,2) NOT NULL,
Total decimal(11,2) NOT NULL,
CName varchar(20) NOT NULL,
UName varchar(20) NOT NULL,
CIP varchar(40) NOT NULL,
UIP varchar(40) NOT NULL,
CDate datetime NOT NULL,
UDate datetime NOT NULL,
PRIMARY KEY (Id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=356 ;

Master/Detail:
loehneerstellen.id=lohnpositionen.RefId
loehneerstellen.Vom=lohnpositionen.Vom
loehneerstellen.Bis=lohnpositionen.Bis
loehneerstellen.Datum=lohnpositionen.Datum
loehneerstellen.Monat=lohnpositionen.Monat
loehneerstellen.Jahr=lohnpositionen.Jahr

Referential Integrity: Unchecked
Cascade Delete: Checked
Cascade Update: Checked

The relation between master/Details is working. I see the korrekt number of details (count details is on).

My Problem: When I update the Datum, Vom, Bis, Monat and Jahr I would like that all these values of detail table are updated too and I have still the relation between master and detail.
But now when Update the master table then there is no updates on detail table fields and the relation between master and detail table is lost.
The cascade deleting is working. In this case the cscade updating is not working.
Could you please advise where to check?

thanks
mpol_ch


Post Reply