In NAV 2013 (70.35345)
I need to import data into several companies in a database. I don't want the user to do anything but launch the process. Any suggestions?
This is what I used to do...
In NAV2009 Classic I would just create a report that cycles through the companies, passes the company name to a Dataport variable through a function (ImportData.SetCompany), sets the FILENAME of the import (ImportData.FILENAME := <path><company name>.txt), run the Dataport (Import.RUNMODAL). The Dataport does a CHANGECOMPANY and imports the data; done. Piece of cake.
This won't work in 2013 because...
The same scheme does not work in 2013 with XMLports.
Using XMLport "variables" always prompts for a filename even if you specify it in code (ImportData.FILENAME) and the XMLport Direction is IMPORT. This becomes tedious and error prone each time the client has to navigate to the file location and pick the right file.
To work around this it looks like you can use XMLPORT.IMPORT(XMLportID, <FileStream>) but then I don't have anyway to change the company into which the data gets imported. So again this becomes tedious because the user would have to run the XMLport, change companies, navigate to the "link" for the import again and run the XMLport, repeat for every company.
This particular client only has 10 or 12 companies so it is workable but there are clients with 20+, 50+, 70+ companies and this becomes a real issue.
<rant>
I suppose I could write something that would work through WebServices (get the list of companies, call a Codeunit in that company that does the XMLport.IMPORT, etc.) but the clients don't use Web Services and I don't really think I should have to get that inventive to resolve a problem that could be resolve within the client before we got "new" and "improved" technology.
Why have we lost functionality with XMLports in 2013 vs. Dataports in 5.0 or even 2009? If XMLport variables would just not prompt for the filename if one is specified it would be done.
It seems we take a few steps forward and we find a U-turn in the technology that seems obviously lacking (to me at least). ](*,)
</rant>
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n