diff --git a/src/NAVObject.ts b/src/NAVObject.ts index 8a8de3f2..50f716f9 100644 --- a/src/NAVObject.ts +++ b/src/NAVObject.ts @@ -624,7 +624,7 @@ class NAVPageField { private _suffix: string; public static fieldRegEx(): RegExp { - return /.*(field\( *"?([ a-zA-Z0-9._/&%\/()-]+)"? *; *([" a-zA-Z0-9._/&%\/()-]+) *\))/g; + return /.*(field\( *"?([ a-zA-Z0-9._/&%\/()-]+)"? *; *([" a-zA-Z0-9._/&%\/()-]+(\[([1-9]\d*)\])?) *\))/g; } get nameFixed(): string { diff --git a/src/test/suite/NAVObject.PrefexAndSuffix.test.ts b/src/test/suite/NAVObject.PrefexAndSuffix.test.ts index 295306ba..fc8fa7b1 100644 --- a/src/test/suite/NAVObject.PrefexAndSuffix.test.ts +++ b/src/test/suite/NAVObject.PrefexAndSuffix.test.ts @@ -102,7 +102,7 @@ suite("NAVObject ObjectNamePrefix Tests", () => { let navObject = new NAVObject(navTestObject.ObjectText, testSettings, navTestObject.ObjectFileName) assert.strictEqual(navObject.pageGroups.length, 2); - assert.strictEqual(navObject.pageFields.length, 3); + assert.strictEqual(navObject.pageFields.length, 5); navObject.pageFields.forEach(field => { assert.strictEqual(field.nameFixed.startsWith(testSettings[Settings.ObjectNamePrefix]), true) }) @@ -128,7 +128,7 @@ suite("NAVObject ObjectNamePrefix Tests", () => { let navObject = new NAVObject(navTestObject.ObjectText, testSettings, navTestObject.ObjectFileName) assert.strictEqual(navObject.pageGroups.length, 2); - assert.strictEqual(navObject.pageFields.length, 3); + assert.strictEqual(navObject.pageFields.length, 5); navObject.pageFields.forEach(field => { assert.strictEqual(field.nameFixed.endsWith(testSettings[Settings.ObjectNameSuffix]), true) }) diff --git a/src/test/suite/NAVTestObjectLibrary.ts b/src/test/suite/NAVTestObjectLibrary.ts index e54f4b97..9cc8d092 100644 --- a/src/test/suite/NAVTestObjectLibrary.ts +++ b/src/test/suite/NAVTestObjectLibrary.ts @@ -228,6 +228,34 @@ export function getPageExtensionWrongFileNameWithActions(): NAVTestObject { { ApplicationArea = All; } + field(ShortcutDimCode3; ShortcutDimCode[3]) + { + ApplicationArea = Dimensions; + CaptionClass = '1,2,3'; + TableRelation = "Dimension Value".Code WHERE("Global Dimension No." = CONST(3), + "Dimension Value Type" = CONST(Standard), + Blocked = CONST(false)); + Visible = DimVisible3; + + trigger OnValidate() + begin + ValidateShortcutDimension(3); + end; + } + field(ShortcutDimCode4; ShortcutDimCode[4]) + { + ApplicationArea = Dimensions; + CaptionClass = '1,2,4'; + TableRelation = "Dimension Value".Code WHERE("Global Dimension No." = CONST(4), + "Dimension Value Type" = CONST(Standard), + Blocked = CONST(false)); + Visible = DimVisible4; + + trigger OnValidate() + begin + ValidateShortcutDimension(4); + end; + } } } }