Dataport Export Not Working

nikhiltoor27
Member Posts: 8
Hi All,
I am trying to export some sales line through a dataport but its now working. The data is being filtered properly. I have written the following code.
RecSalesLine.RESET;
RecSalesLine.SETCURRENTKEY("Document No.");
RecSalesLine.SETRANGE("Document Type","Document Type");
RecSalesLine.SETRANGE("Document No.","No.");
IF RecSalesLine.FINDFIRST THEN
RecSalesLine.CALCFIELDS("Reservation Collected","Quantity Collected");
IF RecSalesLine."Reservation Collected" THEN
REPEAT
ResStatus.SETTABLEVIEW(RecSalesLine);
RetailSetup.GET;
xAutoFileName := RetailSetup."Magento File Export Path" +'ORDER-'+"Sales Header"."No."+'.csv';
ResStatus.MakeFileName(xAutoFileName);
ResStatus.RUN;
UNTIL RecSalesLine.NEXT = 0;
I am calling this dataport through Sales Header dataitem of a report. Can someone help me??
I am trying to export some sales line through a dataport but its now working. The data is being filtered properly. I have written the following code.
RecSalesLine.RESET;
RecSalesLine.SETCURRENTKEY("Document No.");
RecSalesLine.SETRANGE("Document Type","Document Type");
RecSalesLine.SETRANGE("Document No.","No.");
IF RecSalesLine.FINDFIRST THEN
RecSalesLine.CALCFIELDS("Reservation Collected","Quantity Collected");
IF RecSalesLine."Reservation Collected" THEN
REPEAT
ResStatus.SETTABLEVIEW(RecSalesLine);
RetailSetup.GET;
xAutoFileName := RetailSetup."Magento File Export Path" +'ORDER-'+"Sales Header"."No."+'.csv';
ResStatus.MakeFileName(xAutoFileName);
ResStatus.RUN;
UNTIL RecSalesLine.NEXT = 0;
I am calling this dataport through Sales Header dataitem of a report. Can someone help me??
0
Answers
-
It looks like this (even if it worked) would create a separate export file for each and every sales line - one file per line. Is that what you are trying to do? It probably errors out on the first order that has more than one line saying that the file already exists...Kyle Hardin - ArcherPoint0
-
Hi Kylehardin,
I need a one file per order. Please help!!0 -
I dont know about Magento Sync-stuff but your code really doesnt make a lot of sense to me. You are looping through all SL's based on a FlowField of the first Line in the order?
To me this looks like bad/weird design in your addon or just wrong code.
Also you never stated what kind of error occured / what went wrong.
Austrian NAV/BC Dev0 -
Agree with Wisa123. The dataport can do the loop for you so you don't even need a repeat / until.Kyle Hardin - ArcherPoint0
-
Hi Kylehardin,
Thanks for the suggestion. Got through it. exported the data using outstream.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