Entry Numbers update for Detailed Cust. Ledger. entry table
gdkve9
Member Posts: 161
Hai guys,
This seems to be very basic thing but I am struck here. I am renaming the enry no. field for a set of records in the detailed cust. ledger entry table using the following code.
"Detailed Cust. Ledg. Entry"."Entry No." := NewEntryNo;
IF "Detailed Cust. Ledg. Entry".RENAME("Detailed Cust. Ledg. Entry"."Entry No.") THEN
NewEntryNo := NewEntryNo + 1
ELSE
NewEntryNo := NewEntryNo;
I have initialized the NewEntryNo in OnPrereport trigger and I have put the above code in the OnAfterGetRecord Trigger.
But the code is running into a loop it seems and it is not getting updated. Also the sorting key that I have taken is the Entry No. key and table filter I took is to filter the records that I needed to update like( Entry No,filter,>=1000000&<=20000000.
Can I get a solution please..but I am very worried with this small thing ](*,)
Waiting solution as early as possible..regards in advance
This seems to be very basic thing but I am struck here. I am renaming the enry no. field for a set of records in the detailed cust. ledger entry table using the following code.
"Detailed Cust. Ledg. Entry"."Entry No." := NewEntryNo;
IF "Detailed Cust. Ledg. Entry".RENAME("Detailed Cust. Ledg. Entry"."Entry No.") THEN
NewEntryNo := NewEntryNo + 1
ELSE
NewEntryNo := NewEntryNo;
I have initialized the NewEntryNo in OnPrereport trigger and I have put the above code in the OnAfterGetRecord Trigger.
But the code is running into a loop it seems and it is not getting updated. Also the sorting key that I have taken is the Entry No. key and table filter I took is to filter the records that I needed to update like( Entry No,filter,>=1000000&<=20000000.
Can I get a solution please..but I am very worried with this small thing ](*,)
Waiting solution as early as possible..regards in advance
Dilip
Falling down is not a defeat..defeat is when you refuse to get up.
Falling down is not a defeat..defeat is when you refuse to get up.
0
Comments
-
The reason is that the report finds also the already renumbered records.
So you should use a temptable in memory where you store the renumbered records AND delete the not-renumbered records from the real table.
In the OnPostReport-trigger, you can loop the temptable and write them back to the database with the new numbering.
All this has to be done in 1 transaction!
But why would you want to renumber the records?
This can be very dangerous, because you may lose some links.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Create a Global Var for DtldCustLedgEntry
write the following code in OnAftergetRecord
DtldCustLedgEntry.get("Detailed Cust. Ledg. Entry"."entry No.")
IF DtldCustLedgEntry.RENAME(NewEntryNo) THEN
NewEntryNo := NewEntryNo + 1
ELSE
NewEntryNo := NewEntryNo
Mukesh0 -
Thanq Mr.Kriki and Mr.Mukesh
But the code you have mentioned if we write in OnAfterGetRecord, for every record of the master table we have sorted, the loop will run. This works but takes time. Instead as Mr.Kriki told, if we could put that in OnPostReport Trigger it works in one shot..
You both have helped me in sorting the prblm..Thanks and regardsDilip
Falling down is not a defeat..defeat is when you refuse to get up.0 -
If you are Renumbering Ledgers, then the question should be why?
You must have deleted a set of entries to have a gap in the entry numbers, and want to close the gap in the Entry Numbers?
As you say you want to renumber a Range we must assume this is the case, but it is not a good practice to do this!
Ledgers should not be deleteted at all, Never, but journals should be used to reverse any bad postings.
This was not a proper way to deal with this!
When you deleted did you deal with all the other associated tables as well, like Ledger dimensions etc:?
I.M.H.O When answering some of these post the first answer could be why are you wanting to do this, and look at offering a better solution.
I have had to put right a few databases where the quick answer to a problem had been to delete ledgers, but failing to delete all associated tables, lead to major problems, registers, Value entries, application entries and ledger dimensions, being left undeleted.Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
HI
I forgot to mention that in OnPreSection trigger you have to filter all the records that has to be renumbered.
I think, by filterering all the records in OnPreSection the temp table will not be required.
Best Regard
Mukesh
0 -
Just curious, what kind of problems are you having that you want to renumber the ledger entry numbers?? :-kConfessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
This is especially to Mr. Alex chow and Mr. David Cox..
Here I would like to completely share my problem with you. Actually the scenario and the problem is like this..
Here we have 22 different dimensions and 22 databases for those dimensions and we have dimension for head office. Now the transactions scenario is like this...
Sales and Sale Journals will happen in Stores,
Purchases, Purchase journals, Transfers, Item journals relating to adjustments, purchases all this happen in HO(head office).
Now with this scenario I will come to the problem..
Actually we have setup Intial entry nos in LS-Retail Backoffice setup for 17,21,25,32,45,46,254,271,272,281,339,355,379,380,5802,13700, 99001472 tables. But at some stores for 379 table i.e., detailed Cust ledger entry table is picking the initial entry nos other that that stores setup.
For this the reason we identified is like some where in between that store persons have made the transactions in head office and so the intial entry nos are generated based on HO setup and when these transactions are replicated to those stores, after when they have made transactions in their stores the entry nos have generated based on the transaction entry nos that are gone from HO.
But those entry nos will genuinely will be generated in the stores having that intial entry no series. Now when the data is being brought for stores the transactions with same entry nos in different stores are getting clashed. Now what I thought is that I will rename the entry nos in the stores with thier series where the problem has occured and make those store guys not to put the transactions in HO.
But I am not deleting any detailed cust ledger entries but only renaming the entry nos so that then after the transactions will have their store entry no series.
After doing this by filtering against the branch code we are deleting those transactions in HO and again when we replicate the data from the stores the renamed entries will be added so that we dont have any problem. All this I thought because I hope there will not be any link with entry no of the transaction but only the link will be with the Transaction No.
I will be very grateful If you could suggest me in this issue if at all any problems are going to arise in future..hoping for ur quick response [-o<
Thanks n regards..Dilip
Falling down is not a defeat..defeat is when you refuse to get up.0 -
Oh oh0
-
This is wrong in just so many ways [-XDavid Singleton0
-
Ah ok I have worked with Landsteinar Retail, so I understand the problem, Navision should redesign the ledger away from a single "Entry No.", to a multple key, Code,"Entry No.". or a single GUID
Then this would make using distributed databases a lot easier, but retail could do it's bit by making the initial ledger numbering mandatory even for head office, this would also help stop this problem, which has happened lots of times, as it is optional in Retail.
As well as a test to check the Ledger Entry number is not below the Initial Numbering for the database.
Simple solutions can save a lot of time, and bad press!Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Without having experience working with LS Retail, I'm not exactly sure why you came up with this solution.
I can only imagine the headaches you're going to face when you upgrade.
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
deadlizard wrote:Without having experience working with LS Retail, I'm not exactly sure why you came up with this solution.
I can only imagine the headaches you're going to face when you upgrade.
Well in LS Retail for each store database you assign a different range of ledger entry numbers, then these are replicated back to head office, where they hold all ledger transactions for all store, if they have the same number they will get overwritten, that is what has happened here, so you need to renumber to a range that will not be used by another store or headoffice, so my point was if they rethink the ledgers with a code and entry number it would be easier!Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0
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
