Reference tables by table ID is code
Describe the bug Trying to reference a table by ID gives compilation error in al. - In C/AL, the below compiled and would delete all records in tables e.g. 17, G/L Entry table. Now does not compile in AL.
To Reproduce Steps and to reproduce the behavior: Create a codeunit in AL and in the OnRun trigger, type: "17".DELETEALL;
This produces a compilation error.
Expected behavior This code compiled in C/AL, and I would expect that this would compile in AL.
Versions:
- AL Language: 3.0.126630
- Business Central: 14.0.29530
Update?
Hi,
This is not something that we will support in AL. Is this part of converting from C/AL to AL?
Thanks, Thaddeus
Yes, we used this syntax in a pre go-live situation to clear transactional data without clearing master data. Wouldn't compile after conversion.
In AL, you will need to reference the table by name instead of id. We are not going to support using the id.
Was this generated by the TXT2AL tool to convert, or is this a manual conversion?
It was jut a manual conversion. Related question - I have now written something using the Object table where type = Table and RecRef.Deleteall to do this. However, custom tables do not appear in the object table. Is this correct? And is there an alternative way to access these custom tables in anothe way?
Use the record AllObjWithCaption
I am closing this issue because it appears that it has been resolved. Please open a new issue if you believe this has not been resolved and reference the current issue.