[Closed] Filtering on part of primary key results in error

gazpachogazpacho Member Posts: 48
edited 2007-05-24 in Navision Attain
Hi

I have a table with three field (w1, w2, w3, all of type code) and the primary key is 'w1,w2,w3'. Field w1 has a tablerelation with organisation, field w2 has a relation with table department.

I have a form that displays the records of this table in list form.

When I haven't set a filter on any of the field, scrolling past the last record results in the creation of a new record.

But when I have filtered on field w2 - let's say I only want to view department DEPT - and scroll past the last record it rises an error message saying Table Organisation not found. It tries to fill w1 and w3 with '' and w2 with 'DEPT'. But there is no Organisation with value '', so the error pops up.

Is there a way to work around this?

Regards

Josh

Comments

  • ArhontisArhontis Member Posts: 667
    You have focus on another field than the key and it tries to validate the values of the fields.

    Maybe you could put the ValidateTableRelation property of the field (or fields) to FALSE, but in some cases you might get empty records if you move downwards with focus to another field other than one that is part of the key.

    You could do that with the DelayedInsert propery of the form to yes to help you more... :)

    Try a combination of those two properties or just the second and you will find the way...

    Copy/paste of the help follows:
    ValidateTableRelation
    Use this property to tell the system whether to validate a table relationship.

    Applies to
    Fields, text boxes

    Settings
    The ValidateTableRelation settings are:

    To have the system...
    Choose...

    Validate the table relationship Yes (default)
    Not validate the table relationship No

    Comments
    For fields, use this property to tell the system whether or not it should validate the user's entry based on the information already in the table set up through the TableRelation property.

    If you want to let users enter any value without having the system validate the entry, choose No. For example, on the item card you can specify the vendor you normally purchase the item from. In the standard application, this property is set to No for this field, to let users select a vendor that may not already be in the Vendor table.

    For text boxes, use this property to tell the system whether or not it should validate a table relationship.
    DelayedInsert
    Use this property to have the system wait until the user leaves the record before it inserts the new record into the database. By default, the system inserts the new record when the user leaves the control that shows the primary key in the table.

    Applies to
    Forms

    Settings
    The DelayedInsert settings are:

    To have the system insert the record when the user...
    Choose...

    Leaves the record Yes
    Leaves the control that shows the primary key No (default)
  • gazpachogazpacho Member Posts: 48
    Thanks, I will give it a try!
Sign In or Register to comment.