Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions content/docs/analyzers/ApplicationCop/AC0002.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,40 @@ table 50100 "Item Category"
}
{{< /highlight >}}

### Exception

Setup tables are not reported. A setup table holds a single record, and its primary key is always blank by design. No other table relates to that record, so there is nothing for a rename or delete to cascade to.

The rule recognises a setup table by convention, not by checking inbound table relations. A table counts as a setup table when either of these is true:

- its only primary key field is a Code field named `Primary Key` or `PrimaryKey`;
- it declares a parameterless `GetRecordOnce` procedure without a return value.

{{< highlight al >}}
table 50100 "My Setup"
{
fields
{
field(1; "Primary Key"; Code[10]) // Not reported: setup table
{
}
field(2; "Default Location Code"; Code[10])
{
}
}

keys
{
key(PK; "Primary Key")
{
Clustered = true;
}
}
}
{{< /highlight >}}

A single-record table that does not follow this convention is still reported. A Text `Primary Key` field is one example. A key field named `PK` or `Code` without a `GetRecordOnce` procedure is another. Set `NotBlank = false` explicitly on such a field to record that the blank key is intended.

### See also

- [NotBlank Property](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/properties/devenv-notblank-property) on Microsoft Learn
Expand Down
Loading