Updating a form based on the virtual table "Fi

jsnayberkjsnayberk Member Posts: 58
Hello everyone,

NAV 4.00 SP1:
I hope someone can help me with this problem:
I have designed a form which is based on the virtual Table "File". In the OnOpenForm trigger I filter for a specific directory and a specific file type.

The form then should show me all the files in the specified directory and of the specified file type.
This works, but only the first time when I open this form. After deleting these files and reopening the form they are still shown there. Only after closing the company and a new login the form is presenting a correctly updated content.

The background is that in the specific directory are collected files that have to be imported into a NAV-Table.
The user will look periodically if any files have to be imported. The import will be performed by a dataport which will start by a button click on the mentioned form. All the files in the directory will be processed by the dataport.
If the first time the user looks there are no files he will see no files the whole day even if there have been added a lot of new files.



Any ideas?
--
Josef Snayberk

Answers

  • BgestelBgestel Member Posts: 136
    Hi,

    You need to do the following, looks strange but it is the only thing that works .


    make the following code unit, !!! needs to be different code unit then the one with the existing logic !!!


    OBJECT Codeunit 52011 File update
    {
      OBJECT-PROPERTIES
      {
        Date=21-03-05;
        Time=16:25:08;
        Modified=Yes;
        Version List=FORYOU;
      }
      PROPERTIES
      {
        TableNo=2000000022;
        OnRun=BEGIN
                File2.SETRANGE(Path,'C:\');
                IF File2.FIND('-') THEN;
              END;
    
      }
      CODE
      {
        VAR
          File2@1000000000 : Record 2000000022;
    
        BEGIN
        END.
      }
    }
    
    **********************
    ** SI ** Bert Van Gestel **
    **********************
  • ara3nara3n Member Posts: 9,256
    hello, what you need to do is change the filter to something else and then back to original value and it shoudl work.

    For example

    File2.SETRANGE(Path,'D:\');
    if File2.find('-') then;

    File2.SETRANGE(Path,'C:\');
    if File2.find('-') then;


    As you can see I've changed the filter twice and that does the trick.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jsnayberkjsnayberk Member Posts: 58
    Hi ara3n,

    it really does the trick. Thank you.

    Bgestel, thanks to you too. But because the ease of use I prefer ara3n´s solution.
    --
    Josef Snayberk
Sign In or Register to comment.