Hi, Readers.
In this post, I would like to share a developing error handling of Business Central, “The namespace ‘xxxx’ is unknown” in CalcFormula Property.
This is a question I saw from the Dynamics 365 Community this morning. More details: AL Compilation error: “The namespace ‘TableName’ is unknown” when creating
![](https://yzhums.com/wp-content/uploads/2024/05/image-68-1024x573.png)
This isn’t a very complicated question, but the error message is misleading. For example,
The namespace ‘Sales Line’ is unknown.AL AL0791
![](https://yzhums.com/wp-content/uploads/2024/05/Snipaste_2024-05-13_11-19-05-1024x295.png)
As you might know, AL for Business Central supports namespaces from Business Central 2023 wave 2 (BC23), more details: Business Central 2023 wave 2 (BC23): Segment AL code and reduce naming conflicts with namespaces (Namespaces in AL)
This error seems to be a namespace related error, but it is not entirely true. This is an issue with Flowfield’s CalcFormula Property settings. As we mentioned when we were discussing Dynamics 365 Business Central: FlowFields (Sum, Average, Exist, Count, Min, Max, Lookup). There are seven types of FlowFields. Each is described in the following table:
FlowField type | Field type | Description |
---|---|---|
Sum | Decimal, Integer, BigInteger, or Duration | The sum of a specified set in a column in a table. |
Average | Decimal, Integer, BigInteger, or Duration | The average value of a specified set in a column in a table. |
Exist | Boolean | Indicates whether any records exist in a specified set in a table. |
Count | Integer | The number of records in a specified set in a table. |
Min | Any | The minimum value in a column in a specified set in a table. |
Max | Any | The maximum value in a column in a specified set in a table. |
Lookup | Any | Looks up a value in a column in another table. |
For types Exist and Count, you do not need to enter the field name, only the name of the table. The following are two standard examples:
1. Exist: Comment in Item Table
![](https://yzhums.com/wp-content/uploads/2020/11/image-467.png)
![](https://yzhums.com/wp-content/uploads/2020/11/image-484.png)
2. Count: Bill-To No. of Orders in Customer Table
![](https://yzhums.com/wp-content/uploads/2020/11/image-469.png)
![](https://yzhums.com/wp-content/uploads/2020/11/image-485.png)
So there is no problem with the following
![](https://yzhums.com/wp-content/uploads/2024/05/image-70.png)
But you cannot add any fields, such as “No.”
![](https://yzhums.com/wp-content/uploads/2024/05/image-71.png)
Why? Because after supporting namespace, we can use namespace + table name like the following to point to the correct table. Because you added a field at the end, the system thinks that it is the table name and the one in front is the namespace, so this error is prompted.
![](https://yzhums.com/wp-content/uploads/2024/05/image-69.png)
And before namespace is supported, the following error is displayed.
Syntax error, ‘)’ expected AL AL0104
![](https://yzhums.com/wp-content/uploads/2024/05/image-72-1024x522.png)
END
Hope this will help.
Thanks for reading.
ZHU
コメント