As you probably know, Navision does not support Sql-servers relation database - Navision managed this inside as native code. So, when I rename a record, Navision handle which records has to be renamed.
(depending on the tables relation described in the NAV table's properties).
Rename error examble:
I have a Header table with 4 fields in the primary key
I have a Detail table with 5 fields in the primary key (first 4 fields are simular to Header tables primary key, and these fields are related to these fields - otherwise we could'nt rename Header table, and expect Detail table also to be remamed).
Header Table Data in key field (4 fields):
AA BB CC 36
AA BB CC 37
Detal Table Data in key field (5 fields):
AA BB CC 36 1
AA BB CC 36 2
AA BB CC 37 1
AA BB CC 37 2
Now I rename first Header Table record AA BB CC 36 to AA BB ZZ 36.
Now I have:
Header Table Data in key field (4 fields):
AA BB ZZ 36
AA BB CC 37
Detail Table Data in key field (5 fields):
AA BB ZZ 36 1
AA BB ZZ 36 2
AA BB ZZ 37 1
AA BB ZZ 37 2
As you can see, ZZ was renamed in all Detail Table records - including those, where the 4. field was 37.
Am I up against a Navision error, or is there a solution for this problem?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I think, I have set the relationship between the two tables correct up:
(But there are no code in the rename trigger, therefore the problem must be here)
Header Table keys (FH = Primary Key Field in Header Table)
FH1 FH2 FH3 FH4 (Data types: Code10, Code10, Code20, Integer)
Not that I think it matters for Header Table, but never mind:
FH1 and FH2 has a relation to two master tables.
FH3 has no relations (this was the field, I renamed).
FH4 has a relation to Object: AllObj."Object ID" WHERE (Object Type=CONST(Table))
Detail Table Keys (FD = Primary Key Field in Detail Table)
FD1 FD2 FD3 FD4 FD5 (Data types: Code10, Code10, Code20, Integer, Integer)
Relation
FD1 is related to FH1: "Header Table".FH1 WHERE (FH1=FIELD(FD1))
FD2 is related to FH2: "Header Table".FH2 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2))
FD3 is related to FH3: "Header Table".FH3 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3))
FD4 is related to FH4: "Header Table".FH4 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3),FH4=FIELD(FD4))
FD5 has no relation
FD3 is related to FH3: "Header Table".FH3 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3))
It took all where FH1= AA and FH2 = BB and FH3=CC and CC replaced with ZZ. thus your result... ;-) If it should be different, you need to change the table relation and extend it with other fields too...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
FD1 is related to FH1: "Header Table".FH1 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3),FH4=FIELD(FD4))
FD2 is related to FH2: "Header Table".FH2 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3),FH4=FIELD(FD4))
FD3 is related to FH3: "Header Table".FH3 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3),FH4=FIELD(FD4))
FD4 is related to FH4: "Header Table".FH4 WHERE (FH1=FIELD(FD1),FH2=FIELD(FD2),FH3=FIELD(FD3),FH4=FIELD(FD4))
and it seem to work - Thanks!
=D>