Hi everyone,
So I've created a xmlport to import text data to item table and the record don't exist and my xmlport says it was added with success and then raise the error that the item with no '8020150083' already exits. So , so in my item table i see that NOTHING is being added to my table from my text file and there is no item with no 8020150083 like my txt file.
In my text file I have this information,
"8020150083" "TESTE NEW ITEM" "UNI" "8020" "802015" "4,8235" "4,82292" "23" "NAC" "500302081" "" ""
And I have my xml port like the image below and the code,
OnInitXMLport() nbOfSuccess := 0; nbOfError := 0; OnPreXMLport() OnPostXMLport() MESSAGE('Added %1 new items of %2', nbOfSuccess, nbOfSuccess+nbOfError); Item - Import::OnBeforeInsertRecord() EVALUATE(Item."No.",No); EVALUATE(Item.Description, Description); EVALUATE(Item."Base Unit of Measure", BaseUnitOfMeasure); EVALUATE(Item."Item Category Code", ItemCategoryCode); EVALUATE(Item."Product Group Code", ProductGroupCode); EVALUATE(Item."Unit Cost", UnitCost); EVALUATE(Item."Last Direct Cost", LastDirectCost); EVALUATE(Item."Gen. Prod. Posting Group",GenProdPostingGroup); EVALUATE(Item."VAT Prod. Posting Group",VATProdPostingGroup); EVALUATE(Item."Vendor No.",VendorNo); EVALUATE(Item."Vendor Item No.",VendorItemNo); EVALUATE(Item."Item Tracking Code", ItemTrackingCode); Item.VALIDATE(Item."VAT Bus. Posting Gr. (Price)", 'NAC'); Item.VALIDATE(Item."Item Disc. Group",'ALL'); EVALUATE(Item.Integrado, '1'); // LACT001 IF Item.INSERT THEN BEGIN nbOfSuccess += 1; MESSAGE('Item%1 added with success', No); END ELSE BEGIN nbOfError += 1; currXMLport.SKIP; MESSAGE('Item %1 already exist', No); END
*This post is locked for comments
Pretty sure the XMLPort does the insert, so when you do the Item.INSERT you are actually doing it two times.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156