Replies: 5 comments 4 replies
-
But why would you have a flow field with larger field length? |
Beta Was this translation helpful? Give feedback.
-
@StefanMaron It's not about flowfields, it's about 'TableRelation' (combined with ValidateTableRelation = false). We could imagine a field with TableRelation = Customer that allows user to set a 'Customer Filter':
TableRelation to support 99% of the case where the customer fills just one value, but with ValidateTableRelation = false and large field lengths, we allow the user to fill in other / longer values. Case 3 is rather an exception and I can perfectly live with these by adding a Rule should focus on fields having a table relation and a deviating field definition (datatype / length) from the table relations PK. |
Beta Was this translation helpful? Give feedback.
-
@Arthurvdv With the new LC0051 rule in place, I by accident discovered some incorrect field definitions on some of our tables. However, I can't remember if above request / rule has been implemented by either BCLintercop or by MS. None of the cops raise any warnings for below fields. I would have expected to get a warning on mismatching fields definitions.... |
Beta Was this translation helpful? Give feedback.
-
@Arthurvdv Seems to be one of the rules with quit some votes. Any chance on squeezing this one in for the next release? :) |
Beta Was this translation helpful? Give feedback.
-
After three long years of waiting, the moment we’ve all been looking forward to is finally here! 😅 @tinestaric has contributed the rule: LC0076 - Table relation field length mismatch. which is now available in the v0.31.4 (pre)release version of the LinterCop. |
Beta Was this translation helpful? Give feedback.
-
We would like fields referencing master data / other tables to inherit at least the (same datatype? and) minimum field length as the referenced / parent table.
BAD CODE
GOOD CODE
ALSO GOOD CODE
Copied from microsoft/AL#4493
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.
Beta Was this translation helpful? Give feedback.
All reactions