"Table Information" List (Coding Field's Onlookup Trigger)

redhotmustangredhotmustang Member Posts: 91
Hi there,

I'm designing a new table where one of the field needs to get its data from the "Table No." field of the table "Table Information" [field's table relation property: "Table Information"."Table No."].

Since this is a virtual table that has no list form attached to it, how can my field's lookup function be able to show the list of existent database tables?

Any ideas?

Thanks!
Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)

Answers

  • lvanvugtlvanvugt Member Posts: 774
    Build a form for it yourself and program the lookup.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • redhotmustangredhotmustang Member Posts: 91
    I did that, but the issue is I can't attach the form to the LookupFormID property of the "Table Information" table because it's virtual, i.e. does not exist, then we can't access its design. Thus, my field's lookup function won't be able to show that form list.

    P.S.: I've created this topic on the wrong forum, someone please move it to the "NAV/Navision Classic Client".
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
  • crisnicolascrisnicolas Member Posts: 177
    lvanvugt wrote:
    Build a form for it yourself and program the lookup.

    You cannot use the standard lookup (by filling the LookupFormID property on the table). That's why you have to do what lvanvugt already said.... program the lookup yourself
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • redhotmustangredhotmustang Member Posts: 91
    Oops... :oops: I was sleeping there... I didn't even notice there was a link there, nor did I remember to use the OnLookup trigger... ](*,)

    Thanks! :thumbsup:
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
  • redhotmustangredhotmustang Member Posts: 91
    I encountered a few problems when programming the field's Onlookup trigger.

    I wanted to program the table's field directly, and not the table's form, which would be easier.

    I looked up around and I found that I was not the only one facing this issue, as others tried and ended up giving up, some saying it couldn't be done.

    But it is possible, I'm just going to explain how to help others.

    I had a table (named "Number") with an integer field ("No.") that needed to get its data from the virtual "Table Information" table. Since this is a virtual table, we can't access its design view and fill in the LookupFormID property with the list form we want.

    To start, I created a list form for the "Table Information" table called "Table Information List".

    Then, in the Onlookup trigger of the "No." field of the "Number" table I coded this:
    rNum.RESET; // rNum - Table "Number" Record variable
    rNum.SETFILTER("No.",'>1'); // Apply filter
    
    // Runs the form "Table Information List" that I created.
    IF FORM.RUNMODAL(FORM::"Table Information List", rNum) = ACTION::LookupOK THEN BEGIN
      VALIDATE("No.", rNum."No."); // Validates and assigns the value of rNum."No." to the "No." field of the "Number" table
    END;
    

    The funny part is that if we run the "Number" table the lookup works fine, but it does not store the value of the rNum."No." in the "No." field. Only if, we run the form (another form, this one named "Numbers List") which has "Number" as SourceTable does the looukp work and store values.

    Another issue is that, if we have any code, even if it is commented on the Onlookup (control) trigger of the form ("Numbers List"), the lookup stops working.

    Thanks for all your help.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
Sign In or Register to comment.