Dialog Window Closes Too Fast

lloydsmodslloydsmods Member Posts: 93
I have written a dataport that imports transaction records into a table and then launches a function within that table to process the records (validate addresses, create orders, etc.). These files can get pretty huge so running this process can look to the users like nothing is happening for a few minutes or that the system has locked up. So I added a dialog window to display the processing status and update the status as it works. At the end it tells the user how many records were processed and of those, how many orders were created. That way the user can see if there are any discrepancies. The problem is that the window closes as soon as its finished. I don't have a CLOSE command, and yet it shuts down anyway.

The window is opened and updated in the function in the table, not in the codeunit, but this doesn't seem to matter, because the same thing happens if I create a dialog in the dataport (which I don't want to do).

Navsision creates a progress meter when you run a dataport, so could Navision be closing my dialog at the same time it closes the progress meter?
If guns cause crime mine must be defective.

Comments

  • KowaKowa Member Posts: 925
    You can either add

    a MESSAGE statement at the end, showing the records processed,

    or a CONFIRM will enable breaks in between at any point, but will keep tables locked until YES or NO is pressed. This can be avoided by adding a COMMIT before the CONFIRM.

    or close the first dialog window and open a second one, adding a SLEEP statement to keep it open,e.g. SLEEP(5000) keeps it open for 5 seconds.
    Kai Kowalewski
  • SavatageSavatage Member Posts: 7,142
    I have done that on some of my dataports too.

    Put the following Code in the OnPost Dataport Trigger
    BEGIN
    CurrFile.CLOSE;
    IF CONFIRM(Text0001,TRUE,OrderCount) THEN
    ERASE(CurrDataport.FILENAME);
    END;

    Where Text0001 = '%1 Orders Imported / Would You Like To Delete The File?'

    ->You could put anything but I wanted the file to be deleted once imported. You can use the suggestion above and have a Confim "Click yes to close the dialog box"
Sign In or Register to comment.