Filters and Zup file

garthgarth Member Posts: 25
In any form, if you apply a filter with a search string, which returns no records and you exit the form before clearing the filter, you are no longer able to open that form unless you first delete the ZUP file.
Is there a way around this that does not involve putting reset in OnOpenForm of every single form?

Thanks,

Garth

Comments

  • kinekine Member Posts: 12,562
    No, there is no "One click solution" for all forms. You can only add some code into the form which will reset the filters when nothing is found (look into some standard card form and you can see code like
    Form - OnFindRecord(Which : Text[1024]) : Boolean
    RecordFound := FIND(Which);
    CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
    EXIT(RecordFound);
    

    or
    Form - OnFindRecord(Which : Text[1024]) : Boolean
    IF FIND(Which) THEN
      EXIT(TRUE)
    ELSE BEGIN
      SETRANGE("No.");
      EXIT(FIND(Which));
    END;
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,118
    Normally, it should not be a problem to reopen the form. Once open, you click "Show All" to delete all filters.
    In certain cases, it gives an error, but this is always because of some programming. You can fix this in several ways:
    1)By putting the "SaveTableView"-property of the form to FALSE. But in this case, Navision will never save the filters in the zup-file.

    2)In the OnOpenForm-trigger, you can put
    IF NOT FIND('-') THEN
      RESET;
    
    This deletes the filters in case no record is found

    3)Changing the Date or Time of the form. In this way Navision thinks it has been changed and does not re-use the filter-settings saved in the zup-file.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    This is standard functionality of Nav 4.01 (SP1) :mrgreen:

    You can get an upgrade...
    kine wrote:
    No, there is no "One click solution" for all forms. You can only add some code into the form which will reset the filters when nothing is found (look into some standard card form and you can see code like
    Form - OnFindRecord(Which : Text[1024]) : Boolean
    RecordFound := FIND(Which);
    CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
    EXIT(RecordFound);
    

    or
    Form - OnFindRecord(Which : Text[1024]) : Boolean
    IF FIND(Which) THEN
      EXIT(TRUE)
    ELSE BEGIN
      SETRANGE("No.");
      EXIT(FIND(Which));
    END;
    
Sign In or Register to comment.