Options

Lookup virtual table

JedrzejTJedrzejT Member Posts: 267
Hi

How do lookup on the virtual table (object,table information)?

TableRelation do nothing.

Code in OnLookup Trigger show the form(create myself) but after select my field is still empty.

Comments

  • Options
    kinekine Member Posts: 12,562
    PLease, post your code in OnLookup trigger... than I can help...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    JedrzejTJedrzejT Member Posts: 267
    Uh. Thanks

    I do it myself.... i don't create form for my table ](*,)

    My fault.. :oops:
  • Options
    Dean_AxonDean_Axon Member Posts: 193
    you cannot use "lookup" on virtual tabela s there are no forms defined for these tables.

    you have to create forms yourself and then calls these forms in the code.
    Remember: Keep it simple
  • Options
    JedrzejTJedrzejT Member Posts: 267
    JedrzejT wrote:
    Hi


    Code in OnLookup Trigger show the form(create myself) but after select my field is still empty.


    :D
  • Options
    Dean_AxonDean_Axon Member Posts: 193
    Hi JedrzejT ,

    you'll see from the time of my post that it was a little late :oops:

    this time i'll ask first.........

    Have you now sorted this ? if not, post your code :D
    Remember: Keep it simple
  • Options
    JedrzejTJedrzejT Member Posts: 267
    Hello

    Code:

    Table ID-Lookup
    Obj.SETRANGE(Obj.Type,Obj.Type::Table);
    IF FORM.RUNMODAL(54997,Obj)=ACTION::LookupOK THEN BEGIN
    VALIDATE("Table No.",Obj.ID);
    END;

    Field ID-Lookup
    Fld.SETRANGE(Fld.TableNo,"Table No.");
    IF FORM.RUNMODAL(54990,Fld)=ACTION::LookupOK THEN BEGIN
    VALIDATE("Field No.",Fld."No.");
    END;

    I don't need sort this table
  • Options
    Dean_AxonDean_Axon Member Posts: 193
    Hi JedrzejT,

    I tested the first section of code (table) and it seems to work fine on my DB.

    I created a table with 2 test fields:

    Enabled Field No. Field Name Data Type
    Yes 10 Table ID Integer
    Yes 20 Field ID Integer


    I created 2 forms.
    First one for the lookup to the "Object" table
    Second is the form for the table created above.

    Back to my table:
    Created global:
    Name DataType Subtype
    Obj Record Object

    Then went to OnLookup() of the "Table ID" field:

    Table ID - OnLookup()
    Obj.SETRANGE(Obj.Type,Obj.Type::Table);
    IF FORM.RUNMODAL(54997,Obj)=ACTION::LookupOK THEN BEGIN
    VALIDATE("Table ID",Obj.ID);
    END;


    If you still cannot sort this, send me the objects in a PM with the version your running, and ill gladly look at them. :D
    Remember: Keep it simple
  • Options
    krikikriki Member, Moderator Posts: 9,089
    PS : Try to avoid
    FORM.RUNMODAL(54997,Obj)
    

    But rather use :
    FORM.RUNMODAL(FORM::"My Form",Obj)
    
    In this way, there is a connection between the RUNMODAL and the form you want to run. If you use 54997, it is just an integer. If later you need to renumber some objects, it becomes a lot easier.

    Little trick to change your code fast:
    FORM.RUNMODAL("54997",Obj)
    
    When you save+compile and close and then reopen your object, Navision will have changed "54997" in "My Form".
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    JedrzejTJedrzejT Member Posts: 267
    Thanks for help

    I solve it already
Sign In or Register to comment.