Hi,
I am importing some records from .csv file with XMLport.
Now, I want to put progress bar so I would need to count records that I need to import.
Is there any way to count records even before processing all of them? And which trigger I should use?
Thank you very much for your answers!
Greetings
0
Answers
Trigger OnPreXmlPort();
Filename = CurrXMLPort.FILENAME;
XMLDoc = type:DOMDocument
XNLNodeList = type: IXMLDOMNodeList
If we were importing Items from an XML File and our nested Node was 'Item' we can get the count something like this untested code.
EDIT:
Not a xml file so the above would not work, for CSV we need to do it different as length is not the number of lines!
There is no CurrFile like a dataport so you could do something like above and count the lines in the csv file, open the file loop and count the lines and close the file!
Variables:
MyFile = FILE
TempTextVariable = Text 1000
TotalRecNo = Integer
Now you can add a progress bar as normal!
HTH
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
This is awesome!!! =D> =D>
Thank you so much!!!!! :thumbsup: :thumbsup: :thumbsup:
I own you a beer!!! \:D/ \:D/
Cheers!
Hi All,
Hope I can borrow this thread:)
I have written an XMLPort where I import data from text file (*.TXT), everything works fine if I open NAV client where NAV server and NAV client is installed (NST is running), but if I open the NAV client on a Terminal Server (where NST is not running), then I get an error:
Could not find a part of the path 'E:\TESTDATA\REWE-CSV0413.txt.txt'.
XMPort code is this:
error pops here:
ImportedCSVFile.OPEN(currXMLport.FILENAME);
Thank you
BR Damjan
In this case you need first to download the file from the server and then process it.
You can use the codeunit 419 (File Management) to do that.
clientFile := fileMgt.ClientTempFileName('');
fileMgt.DownloadToFile(currXMLPort.FILENAME, clientFile);
ImportedCSVFile.OPEN(clientFile);
....
Regards.
I tried with @ftorenore suggestions, but it works on the NAV Server, but it does not work on terminal server where only NAV client is installed. I am working this on NAV2013 R2 version:)
Error pops:
Debugger stops here
\\192.168.1.239\e$\TESTDATA
As file browser dialog opens, I have to select that exact location: \\192.168.1.239\e$\TESTDATA\file.txt
but, if I save the file to my desktop or on my local disk, and as file browser dialog opens and I select local location: C:\testdata\file.txt than error pops: File was not found.
I checked the user permissions and user has full permissions on folder where file is saved, and user is opening NAV client that runs under his user account, but NST user is not the same user as user who has opened the NAV client.
You can try the other way around and see what happens.
Regards