BartPermentier / al-toolbox

Adds Features to the AL Language Extension
MIT License
13 stars 9 forks source link

Generate SetLoadFields: 'not a local variable' when local variable equals function parameter #49

Closed fvet closed 3 years ago

fvet commented 3 years ago

Given an object with below function with parameter FileTpt ...

local procedure SetModuleType(FileTpt: record "NVT File Tpt")
    begin
        Case FileTpt."Order Type" of
            FileTpt."Order Type"::Transport:
                "Module Type" := "Module Type"::Transport;
            FileTpt."Order Type"::"Freight Forwarding":
                "Module Type" := "Module Type"::Forwarding;
            FileTpt."Order Type"::"Shipping Agency":
                ;
        End;
    end;

... and another function - in the same object - with FileTpt as variable.

local procedure GetSubdepartment() SubdepartmentCode: Code[20]
    var
        FileTpt: Record "NVT File Tpt";
        Shipment: Record "NVT Shipment";
    begin

When trying to apply the SetLoadFields on the local FileTpt variable, I get a 'is not a local variable' error. I would accept this warning in case the FileTpt variable would be used as a global in the object, but I don't see any overlap between these vars / reasons why the SetLoadFields cannot be applied.

dsaveyn commented 3 years ago

Hi fvet,

This has been solved and will be made available in the next release