BUG NAVISION? TableRelation & INSERT

randrewsrandrews Member Posts: 135
edited 2005-10-12 in Navision Attain
BUG NAVISION? TableRelation & INSERT

I Have the table with field Ship-to-Code.
Ship-to-Code have properties
TableRelation="Ship-to Address".Code WHERE (Customer No.=FIELD(Cust No.))
ValidateTableRelation=Yes

1) I change "Cust No." (Ship-to-Code remain from old customer)
2) insert
(not with C/AL. With my hands).

The system allow to insert record with wrong Ship-to-Code !!!
Is it BUG? May be hotfix exists?

P.S. Only VALIDATE("Ship-to-Code") in triger OnInsert helps.

Comments

  • kinekine Member Posts: 12,562
    There is problem elsewhere... when you are changing Sell-to Customer No. the Ship-To code is set to empty (in OnValidate is line "
    VALIDATE("Ship-to Code",'');").

    The question is: why the code is there after you change the Customer No.??? Are you changing the Customer No. with C/AL code without Validating? Yes? -There is problem. If no, and you changed the code manually (on form), problem is that someone modified the OnValidate trigger...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • randrewsrandrews Member Posts: 135
    OnInsert - VALIDATE("Ship-to-Code") is written at the table created by me. So this is not the problem

    But I think that system must look at TableRelation before insert record.

    Programmer say to system "This field have this table relaton". And I consider that he should not write additional code to control relations. IT IS THE BUG in my opinion.

    P.S. Programmer must write additional code to control relations only if he insert(modify) the record by C/AL
    kine wrote:
    There is problem elsewhere... when you are changing Sell-to Customer No. the Ship-To code is set to empty (in OnValidate is line "
    VALIDATE("Ship-to Code",'');").
    If system check table relation on insert - then we can skip VALIDATE("Ship-to Code",'');") in code above
  • kinekine Member Posts: 12,562
    No, it is not BUG, because Navision is not clear relational DB... the ralations are there only for entering the values, not for checking the relations. The relations can be broken and you can test them with DB test... the relations are tested when entering value, but not when inserting record, because if it test it, it will take more time to insert (modify) the record. Of course, this can be changed because more and more is Navision moving to the MS SQL platform and may be that somewhen it will be based on MS SQL rules of relations etc...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    You can say your opinon of course, and to some extent it is kind of strange that in a relational database you can enter an invalid value in a field that has a relationship defined.

    However, it is what it is. You want to make sure the ship-to is correct, you must validate the value. This is a 1.364 second job (the time to type in the word VALIDATE, which of course goes down the more you type it :)) and we can all move on with our lives.

    Don't fight Navision, just learn the features and use them. One day you will be happy that you can store an 'non-valid' value in such a field.
  • bbrownbbrown Member Posts: 3,268
    SQL is not a magic pill. "Rules of Relations" exist only if the database designer implements them. Similar functionallity can be achived with the native database through the use of properties, triggers, and other code.
    There are no bugs - only undocumented features.
  • jesamjesam Member Posts: 100
    Similar functionallity can be achived with the native database through the use of properties, triggers, and other code.

    The difference is that in Navision you have to define the same thing twice. First on the table itself, and then another time in the code of the table, while if you use referential integrity, somthing SQL Server fully supports, you can define it in one place and have the DB Server take care of it for you.
  • randrewsrandrews Member Posts: 135
    I see.

    I know that it need 1 sec to write VALIDATE. I did it before post topic.
    I thought that it wrong. But Kine explain
    Kine wrote:
    No, it is not BUG, because Navision is not clear relational DB...

    So I understood my mistaken opinion.

    Thanks to all.
    Topic is closed :)
Sign In or Register to comment.