AL icon indicating copy to clipboard operation
AL copied to clipboard

Reference tables by table ID is code

Open MarceeMarc opened this issue 7 years ago • 7 comments

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

MarceeMarc avatar Jun 04 '19 08:06 MarceeMarc

Update?

MarceeMarc avatar Jun 11 '19 15:06 MarceeMarc

Hi,

This is not something that we will support in AL. Is this part of converting from C/AL to AL?

Thanks, Thaddeus

thloke avatar Jun 14 '19 09:06 thloke

Yes, we used this syntax in a pre go-live situation to clear transactional data without clearing master data. Wouldn't compile after conversion.

MarceeMarc avatar Jun 14 '19 09:06 MarceeMarc

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?

thloke avatar Jun 18 '19 08:06 thloke

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?

MarceeMarc avatar Jun 18 '19 15:06 MarceeMarc

Use the record AllObjWithCaption

BartPermentier avatar Jul 12 '19 13:07 BartPermentier

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.

atoader avatar Aug 09 '19 09:08 atoader