Hi readers.
In my previous blog, we talked about two solutions to optimize performance of Business Central.
Dynamics 365 Business Central: QueryCategory property (Execute Queries from Pages)
Dynamics 365 Business Central: Record.SetLoadFields Method (Partial Records)
This time I want to share another new feature in Dynamics 365 Business Central 2020 release wave 2. Many expects may have noticed it. Yes, it is TableType Property = Temporary.
MS Docs:
TableType Property
Temporary | Specifies the table as an in-memory only table in the Business Central Server. This table type isn’t synchronized to the Dynamics 365 Business Central database. Specifies the table as an in-memory only table in the Business Central Server. This table type isn’t synchronized to the Dynamics 365 Business Central database. APPLIES TO: Dynamics 365 Business Central 2020 release wave 2 and later. |
PS: This feature is also absent in NAV.
For Example NAV2018:
![](https://yzhums.com/wp-content/uploads/2020/10/image-480.png)
Before BC17, if you want to use temporary tables, there are two ways.
1. using a temporary record variable
![](https://yzhums.com/wp-content/uploads/2020/10/image-481.png)
2. setting the SourceTableTemporary property on a page to true
![](https://yzhums.com/wp-content/uploads/2020/10/image-482.png)
Now there is a final solution, setting TableType property of a table to Temporary.
![](https://yzhums.com/wp-content/uploads/2020/10/image-483.png)
Let’s try it.
Enter some data on the list page.
![](https://yzhums.com/wp-content/uploads/2020/10/image-484-1024x329.png)
Close and reopen it. No data are saved. Same as setting the SourceTableTemporary property to true on the page.
![](https://yzhums.com/wp-content/uploads/2020/10/image-485-1024x278.png)
If I delete some fields or change the Primary key in the table.
![](https://yzhums.com/wp-content/uploads/2020/10/image-486.png)
![](https://yzhums.com/wp-content/uploads/2020/10/image-487.png)
When I published it with Synchronize mode, there were no errors. That’s great, so the table does not have restrictions on breaking schema changes. This will be very helpful.
![](https://yzhums.com/wp-content/uploads/2020/10/image-488.png)
![](https://yzhums.com/wp-content/uploads/2020/10/image-489-1024x517.png)
If the table is not setting to Temporary, you cannot delete fields and modify primary key with Synchronize mode like update extension in Production Environment.
[2020-10-14 17:19:37.68] The request for path /v2.0/Sandbox/dev/apps?SchemaUpdateMode=synchronize&DependencyPublishingOption=default failed with code UnprocessableEntity. Reason: Table ZY Book :: フィールド ‘Title’ が見つかりません。フィールドの削除は許可されていません。
![](https://yzhums.com/wp-content/uploads/2020/10/image-490-1024x299.png)
I think that if the table is only used as a temporary table in Business Central, it is better for developers to use this feature from now on.
END
Hope this will help.
Thanks.
コメント