Dataport Export Not Working

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??

Answers

  • kylehardinkylehardin Member Posts: 257
    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 - ArcherPoint
  • nikhiltoor27nikhiltoor27 Member Posts: 8
    Hi Kylehardin,

    I need a one file per order. Please help!!
  • Wisa123Wisa123 Member Posts: 308
    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 Dev
  • kylehardinkylehardin Member Posts: 257
    Agree with Wisa123. The dataport can do the loop for you so you don't even need a repeat / until.
    Kyle Hardin - ArcherPoint
  • nikhiltoor27nikhiltoor27 Member Posts: 8
    Hi Kylehardin,

    Thanks for the suggestion. Got through it. exported the data using outstream.
Sign In or Register to comment.