Unable to update Customer Card (Salesperson code field)

nikeman77
Member Posts: 517
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;
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
-
my salesperson code i tried both using validation and direct assignment but it doesnt works
cust."salesperson code" := NewSMCode;
cust.VALIDATE("salesperson code",NewSMCode);
PS: There isnt any coding inside Customer table, salesperson code.VALIDATE0 -
it seems like import & excel management cannot co-exists.0
-
I presume that the 3 fields are all variables?
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,
ColinExperience is what you get when you hoped to get money0
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
- 322 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