ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Extensibility-enhancement] Additional key in Field Table

Open PauliusRudminas opened this issue 7 years ago • 9 comments

Hello, I've created a function, that gets a value from a field, when only the names of the table and the field are known. I use the Field table to get the table and field numbers, but it seems the CodeCop code analyzer gives me a warning: "The table Field does not contain the key with the field TableName.AL(AA0210)". Likewise, a warning on Setrange for field name.

Could you please add a key in this table for table and field names? Or will this warning be irrelevant when publishing the extension to AppStore?

PauliusRudminas avatar Oct 10 '19 10:10 PauliusRudminas

@JesperSchulz - can you help with this question?

AlexanderYakunin avatar Oct 16 '19 10:10 AlexanderYakunin

Hello,

Maybe there is some info on this issue?

PauliusRudminas avatar Nov 08 '19 07:11 PauliusRudminas

This is system table and we cannot add keys here.

AlexanderYakunin avatar Nov 12 '19 11:11 AlexanderYakunin

Well alright, but then the question remains - if this will be an issue when publishing because of CodeCop, and we should we figure out a workaround, or - if this can be viewed as an exception and will not cause problems publishing?

PauliusRudminas avatar Nov 19 '19 12:11 PauliusRudminas

I don't think a warning will prevent you from publishing to AppSource. But we should probably address the warning anyway. Looping in @MarcHansenMicrosoft.

JesperSchulz avatar Nov 19 '19 12:11 JesperSchulz

Only AppSourceCop is required.

Could you send a sample code? I am interested in the exact repro and if would should add the key to the system table.

Thanks Marc

MarcHansenMicrosoft avatar Nov 19 '19 13:11 MarcHansenMicrosoft

Thanks for the quick reply! Here are the two functions used:

[TryFunction]
procedure GetFieldValueFromID(ReqTableNo: Integer; ReqTableView: Text; ReqFieldNo: Integer; var ResultValue: Variant)
var
    RecRef: RecordRef;
    FldRef: FieldRef;
begin
    RecRef.OPEN(ReqTableNo);
    IF ReqTableView <> '' THEN
        RecRef.SETVIEW(ReqTableView);
    RecRef.FINDFIRST();
    FldRef := RecRef.FIELD(ReqFieldNo);
    ResultValue := FldRef.VALUE();
end;

[TryFunction]
procedure GetFieldValueFromName(ReqTableName: Text; ReqTableView: Text; ReqFieldName: Text; var ResultValue: Variant)
var
    FldRec: Record Field;
begin
    FldRec.SETRANGE(TableName, ReqTableName);
    FldRec.SETRANGE(FieldName, ReqFieldName);
    FldRec.FINDFIRST();
    GetFieldValueFromID(FldRec.TableNo, ReqTableView, FldRec."No.", ResultValue);
end;

PauliusRudminas avatar Nov 19 '19 13:11 PauliusRudminas

Thanks for the sample.

AA0210 is not a warning but just a information, meaning you should be aware. image

If you have performance issues in this code you should either avoid setting this filter or send us a request to add this key to the system table.

Thanks Marc

MarcHansenMicrosoft avatar Nov 20 '19 12:11 MarcHansenMicrosoft

Ok, thank you for the reply

PauliusRudminas avatar Nov 20 '19 15:11 PauliusRudminas