CodeCop rule for testing field length (TableRelation)
Is your feature request related to a problem? Please describe. If a new field is created, having a table relation, the field datatype/length is set. If the related table definition is changed, e.g. increase of related (key) field length from code 10 to code 20, the fields having a table relation should be increased as well.
Describe the solution you'd like Have a new CodeCop rule that checks any field having a TableRelation to match at least the MINIMUM length of the related field (cfr. test codeunit 134926 Table Relation Test)
Describe alternatives you've considered Running test codeunit 134926 Table Relation Test instead. However, the codeunit sometimes fails, since we have fields - with a tablerelation - that are longer than the related field.
Hi @fvet, thanks for filing this issue. This is a valid suggestion and we will consider it.
Also listed on Experience Ideas https://experience.dynamics.com/ideas/idea/?ideaid=7d1e9e9d-e66f-e911-80e7-0003ff689ebe
Any new votes and comments should go to BC Ideas. :)
moving it back to github
60 votes on ideas. https://experience.dynamics.com/ideas/idea/?ideaid=7d1e9e9d-e66f-e911-80e7-0003ff689ebe
70 by now. Note that there is an indirect workaround being one of the test codeunits. Did write a blog post on it ages ago: https://dynamicsuser.net/nav/b/vanvugt/posts/how-to-test-your-table-relations
This should apply to FlowField lookups also. Can that be done at the same time? It'd make sense. Or must we request it separately?
This should apply to FlowField lookups also. Can that be done at the same time? It'd make sense. Or must we request it separately?
Added this a long time ago as well ;)
https://github.com/microsoft/AL/issues/4494
https://github.com/StefanMaron/BusinessCentral.LinterCop/discussions/41
I hope this issues gains traction, because field length changes in Microsoft Apps may lead to runtime errors.
#5753
We really need this diagnostic. We have wasted a lot of time lately having to fix fields that were too short for e.g. No. Series Code, Salesperson/Purchaser Code, Customer Name, etc. - one by one as they are reported, often with urgent deadlines attached - when a diagnostic would mean we could fix them all at once, in our own time.
Since this seems to have already been done for FlowFields (i.e. I'm not sure why #5753 is still open), surely it is well within your great powers Microsoft? ;-)
Thanks for reporting this issue. Sorry we haven’t completed it yet, but we’ve had to prioritize elsewhere. We’re planning to give the CodeCop engine and its rules an overhaul in a future major release. Thanks for your patience.
Going forward we will not track progress on CodeCop issues here on GitHub. Hence, we are closing this issue.