mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 06:36:55 +01:00
- data-modeling: tablerelation-field-length-must-match-related-field (exact length for unconditional relations, at least the longest target when all relations are conditional; no compile-time diagnostic) - testing: recordref-open-temp-parameter-defeats-real-table-checks (a temp-opened RecordRef is empty, so existence/uniqueness checks on it never see persisted rows; cross-links use-generateguid article) - Wire both into the review leaves and register the fixture pairs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.2 KiB
AL
58 lines
1.2 KiB
AL
enum 50100 "Sample Source Type"
|
|
{
|
|
Extensible = true;
|
|
|
|
value(0; Category) { }
|
|
value(1; Region) { }
|
|
}
|
|
|
|
table 50100 "Sample Category"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Code"; Code[20]) { }
|
|
}
|
|
keys
|
|
{
|
|
key(PK; "Code") { Clustered = true; }
|
|
}
|
|
}
|
|
|
|
table 50101 "Sample Region"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Code"; Code[10]) { }
|
|
}
|
|
keys
|
|
{
|
|
key(PK; "Code") { Clustered = true; }
|
|
}
|
|
}
|
|
|
|
table 50102 "Sample Contract"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Code"; Code[20]) { }
|
|
// Unconditional relation: same type and exactly the same length as
|
|
// "Sample Category"."Code".
|
|
field(2; "Category Code"; Code[20])
|
|
{
|
|
TableRelation = "Sample Category"."Code";
|
|
}
|
|
field(3; "Source Type"; Enum "Sample Source Type") { }
|
|
// All branches conditional: at least as long as the longest related
|
|
// field (Code[20] covers both Code[20] and Code[10]).
|
|
field(4; "Source Code"; Code[20])
|
|
{
|
|
TableRelation = if ("Source Type" = const(Category)) "Sample Category"."Code"
|
|
else
|
|
if ("Source Type" = const(Region)) "Sample Region"."Code";
|
|
}
|
|
}
|
|
keys
|
|
{
|
|
key(PK; "Code") { Clustered = true; }
|
|
}
|
|
}
|