Execute code in menu

clemboclembo Member Posts: 122
I'm migrating old database version (2.60) to 2009 R2.
In old version there is a table used to store different data type. To accomplish this when user open form from menu applied a specific filter. So when I open from menu Item "Car" menu open form applying specific filter. When I open from menu item "byke" menu open form (same form) applyig specific filter to view only "Byke".

In new version there is a way to do it? Can I call from menu a form executing code?
If not how I can solve this problem. I think that solution is makedifferent form but this request too form object and I don't want to do it.

Comments

  • jglathejglathe Member Posts: 639
    Hi,

    you need to call a codeunit from the menu, this can call the form with the filter. I don't know another way.

    With best regards

    Jens
  • clemboclembo Member Posts: 122
    So I need to create a function for every type of data to show in a form?
  • jglathejglathe Member Posts: 639
    Unfortunately, yes.

    with best regards

    Jens
  • GRIZZLYGRIZZLY Member Posts: 127
    Guess, you're talking about incadea.engine. Right?
    I think it's not a problem to use that code:
    Vehicle.RESET;
    Vehicle.FILTERGROUP(2);
    Vehicle.SETFILTER("Vehicle Type",%1',"Vehicle Type"::Byke);
    Vehicle.FILTERGROUP(0);
    FORM.RUN(FORM::"Byke Card",Vehicle);
    
    or am I wrong?
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • clemboclembo Member Posts: 122
    What is incadea.engine?
  • GRIZZLYGRIZZLY Member Posts: 127
    Vertical solution for autodealers, based on NAV 2.6

    BTW, is that code fits you?
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    clembo wrote:
    I'm migrating old database version (2.60) to 2009 R2.
    In old version there is a table used to store different data type. To accomplish this when user open form from menu applied a specific filter. So when I open from menu Item "Car" menu open form applying specific filter. When I open from menu item "byke" menu open form (same form) applyig specific filter to view only "Byke".

    In new version there is a way to do it? Can I call from menu a form executing code?
    If not how I can solve this problem. I think that solution is makedifferent form but this request too form object and I don't want to do it.

    Not sure I got it right but I think this could help you:
    You could use the RunFormView property of the actions that you use to launch page.
    Action 1:
    RunObject     -> YourPage
    RunFormView -> Type=Const(Byke)
    Action 2 -> 
    RunObject      -> YourPage
    RunFormView  -> Type=Const(Car)
    

    Hope this could help.
    ~Rik~
    It works as expected... More or Less...
  • clemboclembo Member Posts: 122
    But I want to use classic client, not Role Tailored.
    When I create a new item I must to specify object type and object name.
    So where I can write this code?
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    clembo wrote:
    But I want to use classic client, not Role Tailored.
    When I create a new item I must to specify object type and object name.
    So where I can write this code?

    :oops: I'm sorry I didn't understand you want to use classic!

    I think that you have 2 ways:
    1. one codeunit as Jens suggest
    2. split your form in 2 forms one for byke and one for car
    ~Rik~
    It works as expected... More or Less...
  • GRIZZLYGRIZZLY Member Posts: 127
    OFF: Stupid menu structure. 3.70 Main Menu form was the best solution.
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    GRIZZLY wrote:
    OFF: Stupid menu structure. 3.70 Main Menu form was the best solution.
    :D nice!
    ~Rik~
    It works as expected... More or Less...
  • clemboclembo Member Posts: 122
    Ehm .. don't work.
    If I need to esecute specific code I need to create one codeunti for every form. So this is not good idea.
    Other choice?
  • GRIZZLYGRIZZLY Member Posts: 127
    What about displaying dialog with options on opening the form?
    User should select what he wants to see, then the filter should be applied.
    So, the concept is that menu has 1 item, when clicking it an additional dialog is shown.
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
Sign In or Register to comment.