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
This isn’t a very complicated question, but the error message is misleading. For example,
The namespace ‘Sales Line’ is unknown.AL AL0791
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
2. Count: Bill-To No. of Orders in Customer Table
So there is no problem with the following
But you cannot add any fields, such as “No.”
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.
And before namespace is supported, the following error is displayed.
Syntax error, ‘)’ expected AL AL0104
END
Hope this will help.
Thanks for reading.
ZHU
コメント