Modify 'table relation' property of a table field at runtime

gazpachogazpacho Member Posts: 48
edited 2005-05-17 in Navision Attain
Hello

I want to narrow a table relation that is defined in the table field properties. How can I change this table relation at runtime ?

thanks.

Comments

  • krikikriki Member, Moderator Posts: 9,112
    You can't.

    You will have to program it manually in the "OnLookup"-trigger of the field. Something like this:

    recMyrecord.RESET;
    recMyrecord.SETCURRENTKEY(Field1[,Field2,Field3,...]);
    recMyrecord.FILTERGROUP(6);
    recMyrecord.SETRANGE(Field1,RangeStart[,RangeStop]);
    recMyrecord.SETFILTER(Field2,SomeFilter);
    recMyrecord.FILTERGROUP(0);
    recMyrecord.Field1 := Initial field1; // these 3 lines are to preset the record on a certain record in the lookupform
    recMyrecord.Field2 := Initial field2; //
    recMyrecord.Field3 := Initial field3; //
    IF FORM.RUNMODAL(FORM::"LookupForm",recMyrecord) = ACTION.LOOKUPOK THEN BEGIN
    VALIDATE("My Lookup Field",recMyrecord.Field1);
    VALIDATE("Some Other Field",recMyrecord.Field2);
    ...
    END;
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • HalMdyHalMdy Member Posts: 429
    Or ... like in a Sales Line, see TableRelation Property of field 6-No.

    Depending on another field, conditionnal relation is done.
Sign In or Register to comment.