I have added a tab control to the bottom of the contact in our NAV 2009 database. I am trying to display 2 different filtered views of the contact comments. I have added a category field of type option that will be used to classify the comments. I want to have two subforms that only display the comments for one category.
I am able to make the comments display properly but when I try to insert a record into one of the subforms, if there is already a record for the other category i get an error saying that the line already exists. It appears that th eform is not populating the Sub No. field which is part of the primary key of the table. I have autosplitkey and populateAllFields enabled on the subforms.
Does anyone have any suggestions for how to make the system populate the key fields properly so I am able to insert records into each of the subforms?
0
Answers
If I remember correctly, only the fields in the TableView property are automatically filled in. It's also hard to say exactly not knowing the structure of the table on your subform.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have tried having both subform controls point to the same subform object and use a different filter in the link. I have also tried having separate form objects for each subform.
The fields contained displayed in the subform are date, category(my additional field), comment, and last date. I also added all of the fields for the primary key (table name, No., sub No., Line No.) to the form and made their columns invisible on the form as well as setting the populateAllFields property to Yes as was suggested in another post on Mibuso. For some reason when I insert a record the Line No. field isn't incrementing properly between the two subforms so that they try and insert duplicate keys.
1) Add the type into the PK before the Line No. field (Line No. must be last)
2) Not use the AutoSplitKey and fill the line no. by own code or use different approach.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.