Please help....how can I get a XML default file location?

boywonder
Member Posts: 179
I'm trying to get an XMLport to open a given folder and filetype.
No problem on the filetype, I simply changed the FileName property in the XMLport to CC*.csv which shows only the files I'm interested in.
But can't figure out a way to do the filename, I tried the old tricks that were used for Dataports but they didn't work.
Help! :?
No problem on the filetype, I simply changed the FileName property in the XMLport to CC*.csv which shows only the files I'm interested in.
But can't figure out a way to do the filename, I tried the old tricks that were used for Dataports but they didn't work.
Help! :?
0
Comments
-
Did you try putting similar code to the OnInitXMLPort trigger:
TempFileName := currXMLport.FILENAME(pathname);Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Yes I did and it kind of works - but only puts the "path text" into the filename box when the Open File dialog box opens - doesn't actually change to the folder unless you hit <Return>....and of course they aren't going to want to have to do that.
Maybe it just isn't possible with XMLports to do any better than that though? :?0 -
Yeah, it's really stupid.
In addition, the XMLport won't function like a dataport if you schedule it using NAS.
In another words, you cannot automate XMLport to have it import .csv files..Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
This might do the trick!?
Create a Function with the following code. I call it from an Action, but it should work when called from the NAS. Shouldn't it?// Import File FileRec.SETRANGE("Is a file",TRUE); FileRec.SETFILTER(Path,GLSetup."File Location Import"); IF FileRec.ISEMPTY THEN ERROR(Text50010,GLSetup.FIELDCAPTION("File Location Import")); FileRec.FINDSET; REPEAT FromFileName := FileRec.Path + '\' + FileRec.Name; IF ISSERVICETIER THEN FromFileName := RBAutoMgt.UploadFile(FromFileName); ImportFile.OPEN(FromFileName); ImportFile.CREATEINSTREAM(InStream); IF XMLPORT.IMPORT(XMLPORT::"Import CSV File",InStream) THEN; ImportFile.CLOSE; UNTIL FileRec.NEXT = 0;
In Codeunit 419 add this functionUploadFile(ClientFileName : Text[1024]) : Text[1024] FileInfo := FileInfo.FileInfo(ClientFileName); ClientTempFileName(FileInfo.Name,FileInfo.Extension); // RTC Temp Folder (=Client) IF FileInfo.DirectoryName <> ClientTempPath THEN // Copy File on Client to Client Temp Folder FileInfo.CopyTo(ClientTempPath + FileInfo.Name,TRUE); UPLOAD('',Magicpath,'',FileInfo.Name,ServerFileName); // Upload Client File to Server IF ERASE(ClientTempPath + FileInfo.Name) THEN; EXIT(ServerFileName);
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions