Strange Table Relation

Hello, I have a problem when setting a relation between a field and a table. (Below, you can see an exemple) If on T74719, i deactivate the secondary key, i can run then table and create a record in the T74718 with code:=1 fourn:=A but if i activate the secondary key, and try to create the same record, when i type A in the field Fourn, the table fill the field with AA value. Is somebody having a solution so i will not have to deactivate key to validate the relation. Thanks for any help. =================================== Example : (NF 2.60A) OBJECT Table 74718 test FD FIELDS { 1 ; ;code ;Code10 2 ; ;fourn ;Code20 TableRelation=“test Fourn” WHERE (test=FILTER(<>’’)) } } KEYS { ;code } CODE {} OBJECT Table 74719 test Fourn FIELDS { 1 ; ;code ;Code20 2 ; ;test ;Code10 } KEYS { ;code ;test } CODE {} ======================================== DATA in T74719 ======================================== code; test A ; V AA ; A B ; V CC ; A D ======================================

Hi Lessi, what is it that you are actually trying to do? Maybe if you could attach the actuall objects, it might help to find the problem. I am not sure what you want to do with the filter on test <> ‘’. PS what error message are you getting? IS it a problem inserting the record, or finding the link? _________________________ David Singleton Navision Consultant since 1991 dmks22@home.com___________

Here, i attach the fob(txt mode) for the two tables. Let’s assume T74719 is vendor table where “code” is the Code of the vendor and “test” is a “Spécial Value”. Vendor A —> Value V Vendor AA —> Value A Vendor B —> Value V Vendor CC —> Value A Vendor D —> No Value T74718 is a table where for each inserted Line I need to choose a vendor, but only the vendor where the field “Test” is not empty. The problem is that when i insert an item in T74719 (by hand): I type 1 in code → OK I type A in fourn → the relation return AA, so i am not able to choose the vendor A even if the relation is OK (test fiels exists for vendor A). If i deactivate the key on test, everything is OK but I need this key for other job. I’m not sure it’s clearer, but it is the best i can do. The only objects i can send to you are the attached files. download

Hi Jean-Marc, Because of the filter on the secondary key Table74719 will be sorted on that field and that’s why Navision finds AA before A. I think the only way to solve this is to test the relation by code. foum - OnValidate() TestFoumRec.RESET; TestFoumRec.SETRANGE(code, foum); TestFoumRec.SETFILTER(test, ‘<>%1’, ‘’); TestFoumRec.FIND(’-’); foum - OnLookup() TestFoumRec.RESET; TestFoumRec.FILTERGROUP(2); TestFoumRec.SETFILTER(test, ‘<>%1’, ‘’); TestFoumRec.FILTERGROUP(0); IF FORM.RUNMODAL(0, TestFoumRec) = ACTION::LookupOK THEN foum := TestFoumRec.test; Reijer.

Hi Reijer, It is the solution which I had found, but I think it is damage that the validateFilter behaves as if you want: filter => fourn=A* & Test<>’’; . If you hand put the filter Fourn=A and test<>’’, even if you sort on test, you got the right answer.

Indeed, it behaves strange. This is better I think: foum - OnValidate() TestFoumRec.RESET; TestFoumRec.SETFILTER(code, foum + ‘*’); TestFoumRec.SETFILTER(test, ‘<>%1’, ‘’); TestFoumRec.FIND(’-’); foum := TestFoumRec.code; PS: you’ll have to delete the TableRelation property of field foum.

Thank everyone for responses. I go to hand code the table validation. Regards,