microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
780 stars 617 forks source link

[Parameter Request] TAB 255 - LookupPostCode #4419

Closed fvet closed 4 years ago

fvet commented 5 years ago

On BC14, I've lots (500+) of overflow warnings (AA0139) on postcode related functions (e.g. LookupPostCode). In https://github.com/microsoft/AL/issues/4838, I wanted to know how to get rid of these warnings, but no answer yet ...

image

In my opinion, the CityTxt and CountyTxt parameters need to have a fixed length again, since they need to be in accordance with the 'Post Code' table definition. The code parameters have, the texts don't, so it makes no sense ...

Looking into the LookupPostCode function, following code is called ...

if PostCodeRec.Get(PostCode, CityTxt)

which would result in an error if CityTxt is too large. Return value is also limited to 50 only.

CityTxt := PostCodeRec.City;

Can you please provide a fix so I can ignore these warnings

AlexanderYakunin commented 4 years ago

To suppress some unwanted warnings you can create json file (e.g. “suppress.json”): { "name": "Suppress", "rules": [ { "id": "AL0432", "action": "None" } ] }

And target it in settings.json: "al.ruleSetPath": "suppress.json"

fvet commented 4 years ago

@AlexanderYakunin I want to avoid excluding these CodeCop warnings via the rulesets, since this would disable the rule for all of our objects as well. The added value of this rule is we can ensure to clean up our app based on the warnings.

With this issue I want to know how MS can deliver their Base Application without any warnings on the standard functions and introduce a fixed parameter length again on the above postcode functions.

procedure LookupPostCode(var CityTxt: Text

to

procedure LookupPostCode(var CityTxt: Text[30]