How to display the exact data selected through lookup form

venkateshvenkatesh Member Posts: 51
hello,
i am selecting a Non stock item from a particular vendor(same non stock item is from more than one vendors) through a lookup in sales line form(Customized funtionality).when i press 'ok',i am not able to get the exact vendor item.It is not giving the exact record what i selected.The Vendor code is not refreshed,it is same even when i select some other vendor item.
Example:
Vendor Item No Vendor Code Unit Price
13838 XXXX 5.05
13838 YYYY 6.00


when i select a vendor item from XXXX,i am getting the price and vendor code of YYYY.
please help me to solve this problem ](*,)

thanks,


regards,
venkatesh

Comments

  • CogCog Member Posts: 12
    Hi,
    actually I don't know exactly what you want to do, but perhaps this will help you:
    lrc_VenorItem.setrange("Item No.", '13838');
    if form.runmodal(0, lrc_VenorItem) = Action::LookUpOK then begin
      lrc_SalesLine.validate("Vendor Code", lrc_VenorItem."Vendor Code");
      ...
    end;
    
  • venkateshvenkatesh Member Posts: 51
    hai cog,
    If i write the coding what you have given above,the existing functionality of sales line like GL Account,Item,Resource,Charge(Item) will be affected.


    thanks in advance
  • CogCog Member Posts: 12
    Hi venkatesh,
    ...through a lookup in sales line form(Customized funtionality)...
    First of all i recommend to implement all CAL-code in tables not in forms, to avoid CAL overlapping.

    There are two possibilities to integrate a Lookup-Form:

    1. to use the TableRelation-Property in a field
    2. to use the OnLookup CAL-Trigger of a field

    And here seems to be the problem. One the one hand you have the TableRelation Property of the "No." Field in table 37. On the other hand you have integrate a CAL-code in the form. That's not a good solution...

    I recommend to use the TableRelation-Property. It's quick and easy.
    More complex functionality must be integrated in the OnLookup-Trigger.
    No. - OnLookup()
    
    CASE Type OF
      TYPE::"G/L Account":
        BEGIN
          lrc_GLAccount.setrange("No.", Code);
          IF FORM.RUNMODAL(0, lrc_GLAccount) = Action::LookUpOK THEN 
            VALIDATE("No.", lrc_GLAccount."No.");
        END;
      TYPE::"Item":
        BEGIN
          lrc_VenorItem.setrange("Item No.", '13838');
          IF FORM.RUNMODAL(0, lrc_VenorItem) = Action::LookUpOK THEN BEGIN
            VALIDATE("No.", lrc_VenorItem."Vendor Code");
            ...
           END;
        END;
           ...
    END;  // CASE
    

    I hope I could help you.
Sign In or Register to comment.