Dynamic setting of look up form in request form

anand_sri12anand_sri12 Member Posts: 71
Dear all

its my first post in the forum. Hope I'll Get the solution.

In Request form How to set the view of look up form dynamically(At Run time)
With thanks

Anand Kumar
Navision Technical Consultant

Answers

  • krikikriki Member, Moderator Posts: 9,115
    You need to program in the lookup trigger which form you want to use.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JoeKJoeK Member Posts: 53
    Hi,

    first, welcome to mibuso.

    The solution of your problem is simple.
    You have to code the on lookup trigger, then call your form with the form.runmodal (run) function. In this function you have the possibility to give the form a table as parameter. if you set some filters on this tables the form will only show the filtered ones.

    example:

    Item.setrange("No.", '1');
    if form.runmodal(Form::"Item Card",Item) = Action::Lookupok then begin
    // Your On lookup ok code
    end;

    Hope this helps....

    edit: Just read the helpfile enty: form.run
  • joycopl_mejoycopl_me Member Posts: 52
    Hi man,

    Its easy for this example. if you want to auto lookup when run the 2nd form. try to use the flowfield on table property

    Caclformula=Lookup("Sales Line".Description WHERE (Document Type=FIELD(Sales Document Type),Document No.=FIELD(Sales Document No.),Line No.=FIELD(Sales Line No.)))

    maybe, it is more help :D

    cheer
    Thang
  • anand_sri12anand_sri12 Member Posts: 71
    JoeK wrote:
    Hi,

    first, welcome to mibuso.

    The solution of your problem is simple.
    You have to code the on lookup trigger, then call your form with the form.runmodal (run) function. In this function you have the possibility to give the form a table as parameter. if you set some filters on this tables the form will only show the filtered ones.

    example:

    Item.setrange("No.", '1');
    if form.runmodal(Form::"Item Card",Item) = Action::Lookupok then begin
    // Your On lookup ok code
    end;

    Hope this helps....

    edit: Just read the helpfile enty: form.run

    Thanks Buddy But I have a different problem

    In my report On the request form I have taken A text box and attached it with a form i.e. customer list, now I want that user will see only those customer which have lets say (Customer Posting Group-- India) means to say I want to set the filter on that form which I set in the property of above text box Now as u know the property of that form will not be displayed in C/A L symbol menu Now How will I set the View of that customer list run time? :-k
    With thanks

    Anand Kumar
    Navision Technical Consultant
  • krikikriki Member, Moderator Posts: 9,115
    recCustomer.RESET;
    recCustomer.SETRANGE("Customer Posting Group",'INDIA');
    IF FORM.RUNMODAL(0,recCustomer) = ACTION::LOOKUPOK THEN
      CodCustomer := recCustomer."Code";
    
    And you can also put the filters in another filtergroup, so the user cannot change them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • anand_sri12anand_sri12 Member Posts: 71
    kriki wrote:
    recCustomer.RESET;
    recCustomer.SETRANGE("Customer Posting Group",'INDIA');
    IF FORM.RUNMODAL(0,recCustomer) = ACTION::LOOKUPOK THEN
      CodCustomer := recCustomer."Code";
    
    And you can also put the filters in another filtergroup, so the user cannot change them.

    In The Request form , I have taken a text box and in its properties I had set

    Source expr -- custno(Variable of type code )
    Table Relation-- Customer."No."(which relate to no. field of customer)
    LookUpFormID-- Customer List(form customer list)

    --table relation doesnt allow me to set external variable like u suggested for writing code

    --LookUpFormID doesnt allow me to set external form defined in C/A L Global for using on code

    Now how can i now set the view of lookup form
    With thanks

    Anand Kumar
    Navision Technical Consultant
  • krikikriki Member, Moderator Posts: 9,115
    You can't use the standard lookupform.
    You have to program all:
    -table to use
    -filters to use
    -form to use [FORM.RUNMODAL(0,...] in case of the standard form or [FORM.RUNMODAL(FORM::"The Form",...] in case of another form.

    And that code you have to put in the OnLookup-trigger of your field.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • anand_sri12anand_sri12 Member Posts: 71
    kriki wrote:
    You can't use the standard lookupform.
    You have to program all:
    -table to use
    -filters to use
    -form to use [FORM.RUNMODAL(0,...] in case of the standard form or [FORM.RUNMODAL(FORM::"The Form",...] in case of another form.

    And that code you have to put in the OnLookup-trigger of your field.

    Thanks , Its Great to have cooperative Professional like u in the forum
    With thanks

    Anand Kumar
    Navision Technical Consultant
Sign In or Register to comment.