Options

Menu Suite

icoutoicouto Member Posts: 5
Hi,
I have a Form that is to be open in two different Menu Items (on Menu Suite), and I would like to filter which data is shown.

For example:
Menu Item 1 -> shows data type A
Menu Item 2 -> shows data type B

Is this possible? How?

Regards,
Ivo Couto.
Ivo Couto.

Comments

  • Options
    HalMdyHalMdy Member Posts: 429
    I think you can not put a specific filter on the call of the form in the Menu Suite ...

    Proposal :
    - duplicate your form with right filter
    - create two Codeunits that call the form with the filter and call the Codeunits from the MenuSuite.
    - ... ?
  • Options
    icoutoicouto Member Posts: 5
    Thanks HalMdy.
    I have already thought that, but I am trying to find a less expensive solution. My license doesn't many forms or codeunits left. :cry:

    Ivo Couto.
    Ivo Couto.
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    HalMdy wrote:
    [...]
    - create two Codeunits that call the form with the filter and call the Codeunits from the MenuSuite.
    [...]
    Why two codeunits? You only need one because you can call the form without parameters :-$
    (just my 2 cent)
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    WaldoWaldo Member Posts: 3,412
    Because he needs to call the form in two places, in two ways...
    I have a Form that is to be open in two different Menu Items (on Menu Suite), and I would like to filter which data is shown

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    You forgot that you can run a form without parameter and so the form shows the data in variant A.
    If he wants to start other than variant A then he needs a codeunit which calls the form with variant B and another codeunit which calls the form with variant C and another ...

    Yes, I know that you can only save one codeunit but every object costs money.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    POOL_DSFTPOOL_DSFT Member Posts: 7
    You can duplicate the form and apply to each one the filter that you want
  • Options
    WaldoWaldo Member Posts: 3,412
    You forgot that you can run a form without parameter and so the form shows the data in variant A.
    If he wants to start other than variant A then he needs a codeunit which calls the form with variant B and another codeunit which calls the form with variant C and another ...

    Yes, I know that you can only save one codeunit but every object costs money.

    Ah, now I see what you mean ... sorry ... ](*,)

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    But the easiest (and imho best) way is to create several forms (as already mentioned by POOL_DSFT and HalMdy).
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    fbfb Member Posts: 246
    And the least expensive way is to put the following code in the OnOpenForm trigger:
    intChoice := STRMENU('Option 1,Option 2');
    CASE intChoice OF
      0: CurrForm.CLOSE;
      1: SETFILTER(myFieldx,'Option 1');
      2: SETFILTER(myFieldx,'Option 2');
    END;
    
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    #-o ](*,) =D>
    I don't see the wood for the trees.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    HalMdyHalMdy Member Posts: 429
    Timo : fully agreed with your Forms-base solution.

    fd : yep, but with that you don't manage the choice from the Menu Suite as asked ... :-k

    Meaby our Navision friends could take this proposal for next release : opportunity to put filters in the calls from Menu Suite ...
  • Options
    WaldoWaldo Member Posts: 3,412
    hm, (imho) I prefer the Codeunit-solution. I'll tell you why ... .

    When (in a near or far future) the form is altered by adding some functionality ... adding some menu-items and so on ... then this should be done in 2 forms [-X . All modifications should be done twice. :-k

    OK, doing this with two seperate forms, it's a less expensive solution, but "less expensive" doesn't mean "better solution". For me, it's less maintainable.

    again, this is only my opinion.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    fb's solutions needs only one form, no codeunits and a minor coding in one trigger.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    WaldoWaldo Member Posts: 3,412
    Yes, OK, but then, every time you open the form, the user has to choose which filters has to be applied. You really think the users wants to click that option every time.

    Also ...

    icouto had to create two menu items ... probably for two seperate types of users who have access to the seperate menus. Choosing filter each time they open the same form ... this is not really user-friendly, is it???

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    kinekine Member Posts: 12,562
    Waldo wrote:
    When (in a near or far future) the form is altered by adding some functionality ... adding some menu-items and so on ... then this should be done in 2 forms [-X . All modifications should be done twice. :-k

    You can go around this by doing the second form something as wrapper form - only run the first form with another filters... and after closing this called form, close itself too... (and you will have form icon in the MenuSuite, not codeunit icon)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    ShenpenShenpen Member Posts: 386
    I think the STRMENU solution is really bad, because it allows the user choose the option he is not supposed to choose, because it is not relevant to his job responsibility. Generally, the surest way to doom a project is to only make functions users allow to do what they need to do. The biggest and more important part is to take away everything from the they are don't need or allowed to do. Both for security reasons and to be fool-safe.

    I'd vote the 2-form solution. No, it is not unmaintainable: the two forms will soon fork and in 3 months they surely will not even resemble each other. Maybe the first is called Something for Salespeople and the second one is called Something for Warehouse People - you can bet in 3 month they will be totally different.

    If you want to make a good project, this approach is unavoidable - to make stuff like Customer Card for Salespeople, Customer Card for Managers etc.

    Do It Yourself is they key. Standard code might work - your code surely works.
Sign In or Register to comment.