need help... regarding relationship

roshanthaparoshanthapa Member Posts: 90
Please enlighten me:

I have two tables and two forms called branch and brand. The brand contains the ralation with branch.
That means the brand contains a field called branch which has relation with branch table. Now The branch also has a list whose editable is set to false.

In my case, the branch list should be non-editable when I press f5 in branch form and should be editable when I lookup from brand table. Please tell me how can this be done. Any help will be appreciated.

Comments

  • roshanthaparoshanthapa Member Posts: 90
    Or we can take this question as "How can we change the properties(like visible or editable) of the form(generally list) from the table/form from which it is being looked-up?".
  • Revolution1210Revolution1210 Member Posts: 161
    Or we can take this question as "How can we change the properties(like visible or editable) of the form(generally list) from the table/form from which it is being looked-up?".

    Create a function on your list form called SetEditable.
    Pass this function a Boolean which you can use to set the mode of your form
    CurrForm.EDITABLE(YourBooleanVar)
    

    Code your lookups similar to:
    YourFormVar.SetEditable(TRUE);
    YourFormVar.RUN;
    
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • roshanthaparoshanthapa Member Posts: 90
    with this code, we can display the list in editable mode but this will not return back the value to the field from where we clicked lookup.

    Any further suggestions?
  • Revolution1210Revolution1210 Member Posts: 161
    with this code, we can display the list in editable mode but this will not return back the value to the field from where we clicked lookup.

    Any further suggestions?

    Set any filters:
    YourTableVar.SETRANGE(... ...)
    YourFormVar.SETTABLEVIEW(YourTableVar);
    

    Set the lookup mode:
    YourFormVar.LOOKUPMODE(TRUE);
    

    Call your SetEditable function:
    YourFormVar.SetEditable(TRUE);
    

    Call the form, retreive the record and process as required:

    e.g.,
    IF YourFormVar.RUNMODAL = Action::LookupOK THEN BEGIN
      YourFormVar.GETRECORD(YourTableVar);
      Code := YourTableVar.Code;
    END;
    
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
Sign In or Register to comment.