Hello everyone,
is it possible to automatically export a csv file form an xmlport into the local directory when the xmlport is run?
thanks in advance
Hello everyone,
is it possible to automatically export a csv file form an xmlport into the local directory when the xmlport is run?
thanks in advance
add the code to a codeunit or processing only report and use that codeunit/report in job queue
Thanks for your answer.
Here a quick summary of my requirements:
I need a job queue which once a month exports all the sales lines for one specific customer and saves this file in my local directory.
How would you suggest doing this?
Also this code should not be inside XML Port, it should be run through a action button.
Hi,
Can you move your code from OnPreXMLport() to OnPostXMLPort()?
Thanks.
I am running the XMLPort from the Development Center.
After I run it the popup from the client opens where I can view or download the file. That file is not empty and contains the relevant data.
I need the file to be automatically downloaded to my local directory everytime the XMLPort is run. For that I added the following lines of code in the XMLPort C/AL Editor:
OnPreXMLport()
CustXmlFile.CREATE('C:\Temp\data.txt');
CustXmlFile.CREATEOUTSTREAM(XmlStream);
XMLPORT.EXPORT(50002, XmlStream);
CustXmlFile.CLOSE;
Now if I run the XMLPort again, the popup in the client shows up as usual and at the same time a file is created in my local directory. The file although is empty.
Thanks for your help
Hi, It looks like there is no data in xmlport itself, you can try to debug your code.
And, I'm not sure if the solution below is relevant to your problem, but hope it gives you some new hints.
http://dynamicslancer.blogspot.com/2017/01/how-to-create-and-save-file-on-local.html
Thanks.
ZHU
If the file is empty check if you have data in the table from where you are exporting. Are you working on Onprem?
Thanks.
I already followed the istructions from your link.
The file is generated but it is empty.
This is my code:
CustXmlFile.CREATE('C:\Temp\data.txt');
CustXmlFile.CREATEOUTSTREAM(XmlStream);
XMLPORT.EXPORT(50002, XmlStream);
CustXmlFile.CLOSE;
You can find some solutions in google for sure
forum.mibuso.com/.../xmlport-export-save-in-a-destination-automatically
André Arnaud de Cal...
293,280
Super User 2025 Season 1
Martin Dráb
232,038
Most Valuable Professional
nmaenpaa
101,156
Moderator