XML Port - Modify data

subhadynamicssubhadynamics Member Posts: 109
Hi all,

I need too use the xmlport for import data to navision Tables. But my code is delete all the data and insert the data every time.This will be creating Log files also. Soi need to Modify the existing data.

Now my Code is given like this

recEmployeeTemp.DELETEALL;
IF ISCLEAR(WebServiceControl) THEN
CREATE(WebServiceControl);
WebServiceControl.getEmployeeDetails_New();
GetEmpFile.OPEN('c:\AllEmployeeDetails.txt');
GetEmpFile.CREATEINSTREAM(GetEmpStream);
XMLPORT.IMPORT(60000,GetEmpStream);
GetEmpFile.CLOSE;

anyones know Using the xmlport can modify the existing Table data ???

Please help me out??

Thanks in Advance
Subha

Comments

  • canadian_baconcanadian_bacon Member Posts: 91
    Change the "temporary" property of the data source to Yes and then add code to change the records in the actual table.
  • subhadynamicssubhadynamics Member Posts: 109
    I have tried with Temporary property yes in the DataSource.

    But How can i write the code for Modification of records in the Table.

    Thanks

    Subha
  • kinekine Member Posts: 12,562
    You can use e.g. OnPostXML trigger to go through the temp table and transfer the modifications into your real table. Or you can use the OnBeforeInsertRecord of the table element to store the modifications on your own (the record will be automatically inserted into the temp table, but you can insert what you need into the real table in this trigger).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rajaninairrajaninair Member Posts: 3
    I have the following query..
    i hv created an xml port for which i hv created a codeunit..
    in my xmlport i hv made Res. Ledger Entry/Chq Printing node as temporay.Nw the problem which m facin is when i run the codeunit the fields are not getting update in my table for d customer uniue no EPAYCUST011..this is the code which i hv written

    IF "Res. Ledger Entry/Chq Printing".FINDSET THEN
    REPEAT
    MESSAGE('%1 1st',"Res. Ledger Entry/Chq Printing"."Customer Unique No");
    gRecor.RESET;
    gRecor.SETRANGE("Customer Unique No","Res. Ledger Entry/Chq Printing"."Customer Unique No");
    IF gRecor.FINDFIRST THEN BEGIN
    MESSAGE('%1',gRecor."Customer Unique No");
    IF "Res. Ledger Entry/Chq Printing"."Customer Unique No"='EPAYCUST010' THEN BEGIN
    gRecor."Corporate Code":="Res. Ledger Entry/Chq Printing"."Corporate Code";
    gRecor."Payment Run date":="Res. Ledger Entry/Chq Printing"."Payment Run date";
    gRecor."EPayment Status":="Res. Ledger Entry/Chq Printing"."EPayment Status";
    gRecor."EPayment Status Reason":="Res. Ledger Entry/Chq Printing"."EPayment Status Reason";
    gRecor."Transaction Value date":="Res. Ledger Entry/Chq Printing"."Transaction Value date";
    gRecor."Bank Refernace No":="Res. Ledger Entry/Chq Printing"."Bank Refernace No";
    gRecor."Corporate IFSC Code":="Res. Ledger Entry/Chq Printing"."Corporate IFSC Code";
    gRecor."Bene Acc No":="Res. Ledger Entry/Chq Printing"."Bene Acc No";
    gRecor."Reverse File Name":="Res. Ledger Entry/Chq Printing"."Reverse File Name";
    gRecor.MODIFY;
    END;
    END;
    UNTIL "Res. Ledger Entry/Chq Printing".NEXT=0;

    plzzzz help
  • davmac1davmac1 Member Posts: 1,283
    Is all this code in your xmlport where your temporary table is?
    Why not set this as a setrange or better still, don't write the records if they are not this value.
  • rajaninairrajaninair Member Posts: 3
    can u plzz explain in detail..as of now with my tis above code the fields are getting inserted in the last line instead for the particular customer unique number EPAYCUST011
Sign In or Register to comment.