AL icon indicating copy to clipboard operation
AL copied to clipboard

CodeCop rule for testing field length (TableRelation)

Open fvet opened this issue 7 years ago • 12 comments

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.

fvet avatar Jan 22 '19 07:01 fvet

Hi @fvet, thanks for filing this issue. This is a valid suggestion and we will consider it.

ghost avatar Jan 22 '19 16:01 ghost

Also listed on Experience Ideas https://experience.dynamics.com/ideas/idea/?ideaid=7d1e9e9d-e66f-e911-80e7-0003ff689ebe

fvet avatar May 06 '19 10:05 fvet

Any new votes and comments should go to BC Ideas. :)

atoader avatar Aug 08 '19 11:08 atoader

moving it back to github

MarcHansenMicrosoft avatar Jan 29 '20 11:01 MarcHansenMicrosoft

60 votes on ideas. https://experience.dynamics.com/ideas/idea/?ideaid=7d1e9e9d-e66f-e911-80e7-0003ff689ebe

MarcHansenMicrosoft avatar Jan 29 '20 11:01 MarcHansenMicrosoft

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

lvanvugt avatar Feb 08 '21 14:02 lvanvugt

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?

dzzzb avatar Feb 09 '21 11:02 dzzzb

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

fvet avatar Feb 09 '21 11:02 fvet

https://github.com/StefanMaron/BusinessCentral.LinterCop/discussions/41

fvet avatar Sep 27 '21 11:09 fvet

I hope this issues gains traction, because field length changes in Microsoft Apps may lead to runtime errors.

#5753

Joneleth84 avatar May 11 '22 09:05 Joneleth84

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? ;-)

dzzzb avatar Jun 17 '22 16:06 dzzzb

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.

mazhelez avatar Jun 21 '22 13:06 mazhelez