LookUp Form

ngebhardngebhard Member Posts: 127
Hello everybody,

we are using a form list for a table that has a different lookup form. Therefore the ok- and cancel-buttons don't work. How can we simulate this lookup-functions. Any ideas?

For example:
within the item table we have an individual item card which uses an individual item list. Going to the item list from the item card, there is no way to select an item (i.e. with enter) that is shown in the item card (like in the lookup table). You need to remember the item no, go back with Escape and search for the item no.

Thanks for any inspiration.
Best regards,
Nicole Gebhard
ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt

Comments

  • fbfb Member Posts: 246
    To simulate the 'LookupTable' PushAction property, you have to include code that looks something like this in the OnPush trigger of a menu item or command button:
    CurrForm.SAVERECORD;
    MyLookupForm.SETTABLEVIEW(Rec);
    MyLookupForm.SETRECORD(Rec);
    MyLookupForm.SETLOOKUPMODE(TRUE);
    IF MyLookupForm.RUNMODAL = Action::LookupOK THEN
      MyLookupForm.GETRECORD(Rec);
    CLEAR(MyLookupForm);
    
  • ngebhardngebhard Member Posts: 127
    Hi fb!

    I know that it is similar to the posted coding but it won't work that way. Any other hints?

    Thanks a lot!
    N.Gebhard
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • kinekine Member Posts: 12,562
    Can you post your code?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ngebhardngebhard Member Posts: 127
    I refered to the coding posted by fb:

    CurrForm.SAVERECORD;
    MyLookupForm.SETTABLEVIEW(Rec);
    MyLookupForm.SETRECORD(Rec);
    MyLookupForm.SETLOOKUPMODE(TRUE);
    IF MyLookupForm.RUNMODAL = Action::LookupOK THEN
    MyLookupForm.GETRECORD(Rec);
    CLEAR(MyLookupForm);

    But this way it won't work. It must be similar to this, but I just don't get it! :oops:
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • philippegirodphilippegirod Member Posts: 191
    Sorry to ask a stupid question... :oops:

    Are you sure your code is in the OnLookUp trigger (that means, are you sure your LookUp property of the control is set to Yes ?

    Usually, this works..... you should have a little problem somewhere...

    You can also define the filters instead of linking directly the tables :
    TableToLookIn.SETRANGE(Field,Rec.Field);
    TableToLookIn.SETRANGE("Field 2",Rec."Field 2");
    IF FORM.RUNMODAL(Form ID,TableToLookIn) = ACTION::OK THEN
       My destinationField := TableToLookIn.Field
    ELSE IF FORM.RUNMODAL(Form ID,TableToLookIn) = ACTION::Close THEN
       My destinationField := TableToLookIn.Field;
    

    This is something wich works easily.... You should to find what's the problem or give us more elements..

    Good luck and courage.
    My candle burns by both ends, it will not last the night,
    But oh my foes and oh my friends, it gives a lovely light
  • ngebhardngebhard Member Posts: 127
    I made a typical beginner error. I forgot to delete the entries in the menu button "action > run object" as I entered the coding in the push trigger.

    Therefore it didn't work!!
    Sorry... :oops:

    Now it works perfect!!
    Thanks a lot
    :D
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
Sign In or Register to comment.