Fields Case Sensitive

kolaboykolaboy Member Posts: 446
Hi Experts,
I am presently finding my filtering of report to be case sensitive. I have to type Capital letters before my filter can work. If i type Small letters it does not work.

Can anyone tell me what to do to stop the case sensitivity on my report filters.

I want my report to filter without any case. i.e whether Capital letter or Small Letters it should not Matter,I want it to filter.

Can anyone help.
Regards

Comments

  • WaldoWaldo Member Posts: 3,412
    Just begin your filter with a "@".

    Like @*myfilter* will give you:

    myFilter
    myfilter
    MYFILter
    ...

    :)

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • kolaboykolaboy Member Posts: 446
    Hi Waldo,
    Your suggestion worked. But can i have it inside a code without writing it in front of the filter? i.e @lamin

    This is because we want them to type any case to have the report work. Doing as you said can make their work tedious. they might even be forgetting to write the @ symbol.
    Any idea.
    Thanks
  • kinekine Member Posts: 12,562
    You can use
    MyRecord.SETFILTER(MyField,'@%1',MyFilter);
    
    if users are entering values, or
    MyRecord.SETFILTER(MyField,'@'+MyFilter);
    

    if users are entering filter.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kolaboykolaboy Member Posts: 446
    Hi Kine,

    Whats wrong with this code

    OnPreReport

    @*EmployeeFilter := Employee.GETFILTERS;

    If it is wrong , Can you please let me see the correct code and where should it be placed.

    Thanks.
  • ara3nara3n Member Posts: 9,258
    getfilters returns all the filters for all the records.

    the string looks like this.


    Amount: -100..100, Date: 010196..123196 
    


    so your code will not work.

    you need to use getfilter for every field

    EmployeeNoFilter := '@'+Employee.getfilter("No.");
    Employee.setfilter("NO.",EmployeeNoFilter);

    EmployeeNoFilter := '@'+Employee.getfilter("Name");
    Employee.setfilter("Name",EmployeeNoFilter);


    Something like that.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kolaboykolaboy Member Posts: 446
    Hi ara3n,

    I have used your code but it is still not working. Below is your code:

    EmployeeNoFilter := '@'+Employee.getfilter("No.");
    Employee.setfilter("NO.",EmployeeNoFilter);

    EmployeeNoFilter := '@'+Employee.getfilter("Name");
    Employee.setfilter("Name",EmployeeNoFilter);

    I put it on ; OnPreReport() trigger on the report form designer, but it did not work.
    Can anyone tell me the problem. Did anyone have any code that can work?
    Please any suggestion.
    Regards.
  • kinekine Member Posts: 12,562
    Filter must be set in OnPreDataItem else will be lost.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kolaboykolaboy Member Posts: 446
    Hi Kine,
    I have put the code on OnPreDataItem(), but it is not still working. I have tried it in all the Possible places but it still did not work.

    I am suspecting that the Code has a problem. I have modified the code in various possible ways, but it still not working too.

    Did anyone have this problem before? Can anyone help Please.
    Regards.
  • kinekine Member Posts: 12,562
    It seems that problem will be somewhere else. You want to set the filter on some dataitem? If yes, be sure that you set the filter over correct "variable" (variable for the dataitem, or you can skip the variable and use the filter as if it is over Rec variable...)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kolaboykolaboy Member Posts: 446
    Hi Kine,

    The filter have been set already and i can filter by any field in the employee table in the employee registration report[This is a new report i created], but the problem is i can only type capital letters to get my report coming out, but when i type small letters nothing comes out. This is why i suspect case sensitivity in Navision. I was thinking that you can have somewhere in Navision database where you can go and change it to case insensitive and i get my report in what ever case i type.

    If that is not available, i try using code that can solve this, but i have still not found any code code that will solve it. I have used the one suggested by ara3n but it has not work yet. I was thinking if someone can look at it and see what might be wrong with it.
    Any idea please.
    Regards.
  • SavatageSavatage Member Posts: 7,142
    It's not that you haven't found code to do what you need to do. It's that you don't seem to know what to do with the code and impliment it correctly.

    I assume you can go the reverse way of typing in your filter into some textbox variable & making it uppercase at that point??

    MyFinalFilter := UPPERCASE(TextBoxVariable);
    then use setfilter, etc etc.

    It sure seems alot easier to hit the "Cap Lock " button or type '@'.
    :lol:
  • David_SingletonDavid_Singleton Member Posts: 5,479
    kolaboy wrote:
    Hi Experts,
    I am presently finding my filtering of report to be case sensitive. I have to type Capital letters before my filter can work. If i type Small letters it does not work.

    Can anyone tell me what to do to stop the case sensitivity on my report filters.

    I want my report to filter without any case. i.e whether Capital letter or Small Letters it should not Matter,I want it to filter.

    Can anyone help.
    Regards

    Personally I think the thread is heading in the wrong direction. I think Harry is bringing a bit of the real world back to it. Its all a matter of opinion I guess, but I personally don't like to see someone writing code (especially if they are not sure how exactly to use this code), when simple user training can solve the issue.

    The issue here starts with users filtering on text fields. This is a big no no in Navision, unless its just for add hock one off situations. Eg you are trying to do a quick hack report to print all items that have the word Blue in them, because some people wrote it wrong, and you want to clean up BLUE, Blue, blue so you filter @*blue*. But this is not something you do every day. If the users need to do it every day, then the report needs to be rethought our, and hopefully done using Code fields. If this user is on SQL, and is using anything other than 850 or 437, then the filters are going to be a huge performance drag on the system.

    Now it gets worse, that if you write code on one report on say 10 fields that they want to filter on, you can be 100% certain that they client will come back and say the report does not work, because they want to filter on the eleventh field, and they will want the report fixed for free, AND they will start to think of this as a feature of Navision, and you will find yourselves for ever modifying reports for free.

    So the reports that they run multiple times a day, need to be re thought out to filter AND SORT on code fields, and for the "one offs", train the users.

    Please listen to Harry, he uses Navision every day, and really knows how to get the most out of it without coding like crazy.
    David Singleton
  • kolaboykolaboy Member Posts: 446
    Hi Experts,
    Thank you all very much for your beautiful suggestions. they have really helped me a lot. I have now solved the problem and its working fine now. \:D/
    Regards.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    kolaboy wrote:
    Hi Experts,
    Thank you all very much for your beautiful suggestions. they have really helped me a lot. I have now solved the problem and its working fine now. \:D/
    Regards.

    So what was the solution in the end?
    David Singleton
  • kolaboykolaboy Member Posts: 446
    Hi Experts,
    The Code that i used is as showned below:

    IF Employee.GETFILTER("First Name") <> ''
    THEN BEGIN
    NameFilter := '@'+Employee.GETFILTER("First Name");
    Employee.SETFILTER("First Name",NameFilter);
    END;

    IF Employee.GETFILTER("Last Name") <> ''
    THEN BEGIN
    LastNameFilter := '@'+Employee.GETFILTER("Last Name");
    Employee.SETFILTER("Last Name",LastNameFilter);
    END;

    Regards.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    kolaboy wrote:
    Hi Experts,
    The Code that i used is as showned below:

    IF Employee.GETFILTER("First Name") <> ''
    THEN BEGIN
    NameFilter := '@'+Employee.GETFILTER("First Name");
    Employee.SETFILTER("First Name",NameFilter);
    END;

    IF Employee.GETFILTER("Last Name") <> ''
    THEN BEGIN
    LastNameFilter := '@'+Employee.GETFILTER("Last Name");
    Employee.SETFILTER("Last Name",LastNameFilter);
    END;

    Regards.

    ](*,) ](*,) ](*,) ](*,) ](*,)

    What's the point #-o
    David Singleton
Sign In or Register to comment.