i have a dataport that takes in 3 field:
1.customer code,
2.old salesperson code,
3.new salesperson code
Its suppose to functions as find the customer code, replace the new salesperson from csv file.
-My csv files have 2 record for testing purposes, all data
(customer code, old salesperson code, new salesperson code )in the csv files are valid data
-My Data Field for dataport as follows:
CustCode
OldSMCode
NewSMCode
-Properties
AutoSave = <YES>
AutoUpdate = YES
AutoReplace=<No>
Without using the commit code at the end of my code, it can't modified the necessary records.
Cust.Modify;
COMMIT;
0
Answers
Set DataItem as Integer (NOT Customer)
SORTING(Number)
AutoSave, update,Replace = No
Dataport properties:
Import = Yes
Integer - OnAfterImportRecord()
CLEAR(RecordVar);
RecordVar.SETRANGE("No.",Var1);
IF RecordVar.FINDSET THEN WITH RecordVar DO
REPEAT
"Yourfield Code" := Var2;
MODIFY;
UNTIL RecordVar.NEXT=0;
Your code would be more like:
IF Cust.GET(Var1) THEN BEGIN
Cust.."Yourfield Code" := Var2;
etc...
Cust.MODIFY;
END;
The data could be saved from Excel as TAB delimited and you set up the delimiters in the dataport to match
<TAB> in place of the <,> if the comma is used in the data (not in this case however).
Cheers,
Colin