How to create status bar to while import txt files?

hi all, i have done importing something from txt files
how to create status or progress bar…??

If you are importing through dataport, just turn the ShowStatus property of dataport on.

Else, you have to use that window, dialogue logic that is used in posting routine…

I’m using report for importing…

Hi Stan,

Search the C/SIDE Help on Dialog - you use the OPEN, UPDATE and CLOSE functions. An example is in the posting codeunit 80 Sales-Post

Try creating 3 variables. One of then as DIALOG type (DialogVar for ex.). The others as Integer type (NumRecVar and CountVar).

Then use next code:

I suppose that DataportVar is your Dataport variable in your report.

DataportVar - OnPreDataItem()

DialogVar.OPEN(‘Configuring report @1@@@@@@@@@’); // Use so much @ at the end as you want to be long your progress bar

NumRecVar := DataportVar.COUNTAPPROX; // to get the number of records of your dataport. Be carefull to get flters before this.

CountVar := 0; // A counter

//… rest of your Code

DataportVar - OnAfterGetRecord()

DialogVar.UPDATE(1,ROUND(CountVar / NumRecVar) * 100,1)*100); // You’re calculating percent of total records. Each decimal is one point over 100 of total :slight_smile:

CountVar := CountVar + 1;

//… rest of your code

DataportVar - OnPostDataItem()


If you want to show more progress bars for more variables, like customer name, you must use @2@@@@, @3@@@@, etc… and then in UPDATE code you should use UPDATE(2, ROUND…), UPDATE(3, ROUND…), etc.


Victor’s reply is a good place to start. Be careful using COUNTAPPROX, though. I’ve seen it not work too well and had progress bars hang on 100% for a while. I usually prefer to use COUNT, but it does take longer.

As DaveT suggested you can also look at the posting routines. DIALOG is the place to start searching.


when you say you import data using a report I would guess that you use a file type variable and stream the data into Navision?

In this case you would use the file.LEN instead of COUNT or COUNTAPPROX and you would need to imcrement the CountVar variable by the number of bytes being read.