Options

Prevent user from selecting specific data in report filter

ayashiayashi Member Posts: 78
Dear all,

How do I prevent user from selecting specific data in report filter ?
Eg :

If I open Whse.Shipment Status, for field location I already filter in location list form to only show Location code 'GREEN' and 'BLUE'.
But if user manually type 'WHITE' value in location code field, the report can still running. How do I prevent this ?

Thanks In Advanced

Comments

  • krikikriki Member, Moderator Posts: 9,120
    Let the user change it if he wants.
    Overrule the filter of the user by putting some code in the OnPreDataItem-section of the report.
    Something like
    SETFILTER("Location Code",'Your Filter');
    Probably you did something like this in the form.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    Or you can use another filtergroup to apply your filter. In this case, user can filter what he want, but you will limit the locations he can see. Because the result will be interception between your filter and user filter.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ayashiayashi Member Posts: 78
    edited 2006-09-20
    Hi all, thx for responding,

    @Kriki, what if I want to show error message if the user put invalid value (unlike in the table that already limited by filter) ? By using the code you provide, it would force the data to filter by the value I entered.

    @kine, I already limit the location user can see, but I can't stop user from input manually other value beside the one that can be seen by them.
  • kinekine Member Posts: 12,562
    No, I mean use the filter in the report, not on the "lookup". Just add the filter KRIKI wrote, but add it into another filter group. The user filter will be preserved, but your filter will be used too and result will be the intersection and that's what you want... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,120
    ayashi wrote:
    @Kriki, what if I want to show error message if the user put invalid value (unlike in the table that already limited by filter) ? By using the code you provide, it would force the data to filter by the value I entered.
    The problem is that it will only be possible when the user has launched the report.
    In stead of overwriting the filter (or like kine wrote:putting it in anther filtergroup), you can test if the filter the user has put is valid and if not just give an ERROR.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ayashiayashi Member Posts: 78
    edited 2006-09-20
    @kine
    hi, sorry, i'm still newbie in navision, i'm a little bit confused when reading "add it into another filter group", could you kindly described it to me what is this mean ? thx

    @kriki
    "you can test if the filter the user has put is valid"
    How do I get the value that user input ? Cause if i just put code :
    Message("location code"), it gives me empty string, even when I alread put the value in the filter.

    Thx
  • kinekine Member Posts: 12,562
    Please, read on-line help for command FILTERGROUP. Short Description: filter group is something like "layer" of filters. There are many Layers in which you can set filters and result is the intersection of the filters. One layer are filters set through SourceTableView property, another is user defined filters, another are filters from RunFormLink etc...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ayashiayashi Member Posts: 78
    @kine,

    thx a lot, after browse this forum, I finally understand the meaning, and able to solve my problems.

    Thanks to you all :D
Sign In or Register to comment.