BusinessCentral.LinterCop
BusinessCentral.LinterCop copied to clipboard
LC0017 triggers on Global Variable?
I have a global variable called "Difference" of type Decimal. When trying to assign a Value to Difference LC0017 triggers even though it is a Global Variable and no FlowField. I checked the Record that is used but the Record also doesn't have a field called "Difference".
Difference, DifferenceAfterCorrection, TotalActualCreditInsurance, TotalExpectedCreditInsurance : Decimal;
Is that a bug from LC0017 or am I missing something?
I believe this is a false positive, where the rule shouldn't raise a diagnostic on that.
Can you share a small code sample to reproduce this?
Okay, so I tried a few different examples and it seems to be due to my dataitem in my Report. When I use the following code it works without any warnings:
But as soon as I use a the "VDIT_Transaction" dataitem it shows the warning:
So it seems like all Dataitems worked except "VDIT_Transaction". Unfortunately I cannot share the source code for "VDIT_Transaction". But I already checked the source for any occurrence of "Difference" where there are no results.
Any ideas what's causing this?
The false positive is caused by something with the "VDIT_Transaction" table, where I'm completely in the dark on this.
You could try creating an new AL project and copy/paste over the table and report entity and bring it down to the minimum to reproduce this. Maybe the field definitions is enough, where you can remove procedures and/or triggers on the table.
@Mkublbock, are you still running into this issue? If yes, did you by any chance have time to put together a minimal AL project to reproduce it?
Hey @Arthurvdv, sorry for the late response. The issue still persists. I tried your approach of creating a new project and copy pasting over the VDIT_Transaction table. Interestingly the warning will not show then. I've have had to remove some lines because of missing dependencies though. So maybe the error was in one of these lines.
Still, I don't know what's causing this wrong warning but I guess we'll just surround it with pragmas