Progress bar for xml port

Iam creating A Progress bar for an XML import (I am reading an CSV fine here).

My code:


rdialog Dialog

totalrecs Integer

Counter Integer

– On PreXMLPort()


CLEAR (rdialog);

rdialog.OPEN (‘Rec inserted : #1##################’);


– Onafter inserted rec()

Counter := 1 + counter;

– On Before inserted rec ()


Am I doing something wrong here? I just want to see the counter counting in the dialog screen,

best you follow

please, always add the nav version in tag list. thx.

There is nothing wrong with your code, except that you are incrementing AFTER and update the dialog BEFORE you write the record,

On the other hand, this does not give you a progress bar.
I have not seen a progress bar working for an XML port as we are missing two important things in the XMLPort to achieve this:

  1. thing missing is the size of the file (=100% of the progress bar)
  2. thing missing is the position of the file pointer after reading from file (=X% of the progress bar).

So what you can do is to show “some” information like the record counter you are runnign with, but you cannot display a progress bar.

OnAfterInsert AND OnAfterModify triggers:

Counter += 1;

But you must be aware of the following issues:

The dialog might seem to disappear (it jumps to the background)
It will slow down your import when you update the screen after each record.
The following code will update after 10 records only, you can play with the MOD number to get reasonable update times - depending on the number of records expected.

Counter += 1;
IF Counter MOD 10 = 0 THEN

hi mohamed,

no problem to develop a progress bar for a xmlport.

i did the following: i created a xmlport with root element, type text. then sub element item, type table, data source item and added some fields (no., desc, …). i set the xmlport to direction export, format=variable text to get a csv file.

then added the same global variables as you.

rDialog Dialog

RecsCount Integer

index Integer

the code:


// @ sign needed instead of # to get the progress bar.

rDialog.OPEN (’@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@’);



Item - Export::OnPreXMLItem()

RecsCount := Item.COUNT;

Item - Export::OnAfterGetRecord()

SLEEP(100); // not needed, but nicer to watch the increasing progress bar and the counter :wink:

// calc. a percentage value in the update function, multiply with a big number. makes a nice progress bar value


index += 1;



Sorry, Jonathan, he wanted to have the progress bar on IMPORT, not on EXPORT.
If he would have asked for a progressbar on export, your solution would work perfectly.