Changing the Customer No. from alpanumeric to numeric
drevell
Member Posts: 7
I am having a hard time finding a automated way to rename the customer No. and having it cascade the changes down through the other tables that the Customer No. is written in. (i.e. the sales invoice header, etc.) Has anyone had to do this? If so could you share the solution.
David E. Revell
David E. Revell
0
Comments
-
Hi,
The RENAME function should work:
RENAME (Record)
Use this function to change a primary key in a C/SIDE table.
RENAME will select the best key (index) available when renaming linked records.
Regards,
Bruno0 -
I tried to use the:
Customer.RENAME(Customer."No.");
and it doesn't rename the Customer No's0 -
drevell wrote:I tried to use the:
Customer.RENAME(Customer."No.");
and it doesn't rename the Customer No's
Hi,
first you should locate the record you would like to rename. Then provide a new value(s) of primary key field(s) to the RENAME command. The example could be:
Cust.GET('10000');
Cust.RENAME('123456');
...or...
Cust.FIND('-');
Cust.RENAME('NEW' + Cust."No.");
But! This would not work:
Cust."No." := 'NEW' + Cust."No.";
Cust.RENAME(Cust."No.");Regards, YUH0 -
Thanks for that help; but I'm trying to loop through all the records (customers) and rename each to the new default No. Series that I've defined (C-Cust 1-99999999). I'd like to do this without having to define a report to look for each customer name but instead loop through and then rename it to the Last No. Used. Any thoughts?
Thanks in advance for the help
David Revell0 -
Hi,
be careful doing that. You can easily create a neverending loop if you use the primary key. Try to save the original customer nos into a new field, than create a new key on this field. Than use the newly created key to renumber the records. I had some problems when i was renumbering fixed assets.Brg,
--
János Borsics0 -
You can use a report that cycles through all the customers and have a variable defined as customer and rename the variable.
So something like this:
Customer
"OnAfterGetRecord"
VarCust := Customer;
varCust.No := NoSeriesMgt.GetNextNo(NoSeriesCode, SeriesDate, ModifySeries)
varcust.rename(varcust.no);Don't just take my word for it, test it yourself0 -
I got a report with the following code to work, but it is very slow with our 3000 customer list. Does anyone know how to speed this up?
"Customer No. Old" := "No.";
SalesSetup.GET;
CLEAR(NewNo);
NoSeriesMgt.InitSeries(SalesSetup."Customer Nos.",SalesSetup."Customer Nos.",0D,NewNo,SalesSetup."Customer Nos.");
RENAME(NewNo);
Variables
Name DataType Subtype Length
NoSeriesMgt Codeunit NoSeriesManagement
SalesSetup Record Sales & Receivables Setup
NewNo Code 200 -
A couple of things:
1. Don't get the salessetup every time. Do it on PreDataItem, the code is not going to change.
2. NoSeriesMgt.InitSeries calls NoSeriesMgt.GetNextNo so you don't need that. Do a "varCust.No := NoSeriesMgt.GetNextNo(salessetup.NoSeriesCode, 0d, true);"
3. As rename cascades through all values that link to Customer.No it is always going to be slow. So if you need to do it in a limited amount of time, you'll have to split the job using filters.Don't just take my word for it, test it yourself0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions