diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/Template/Test/QltyTestCard.Page.al b/src/Apps/W1/Quality Management/app/src/Configuration/Template/Test/QltyTestCard.Page.al index 587230a973..5d2e579efd 100644 --- a/src/Apps/W1/Quality Management/app/src/Configuration/Template/Test/QltyTestCard.Page.al +++ b/src/Apps/W1/Quality Management/app/src/Configuration/Template/Test/QltyTestCard.Page.al @@ -444,55 +444,31 @@ page 20479 "Qlty. Test Card" } group(SettingsForLookup) { - Caption = 'Lookup'; + Caption = 'Table Lookup Configuration'; field("Lookup Table No."; Rec."Lookup Table No.") { Editable = IsLookupField; AboutTitle = 'Lookup Table No.'; AboutText = 'When using a table lookup as a data type then this defines which table you are looking up. For example, if you want to show a list of available reason codes from the reason code table then you would use table 231 "Reason Code" here.'; - - trigger OnAssistEdit() - begin - if IsLookupField then - Rec.AssistEditLookupTable(); - end; } field("Lookup Table Name"; Rec."Lookup Table Caption") { Editable = IsLookupField; AboutTitle = 'Lookup Table No.'; AboutText = 'The name of the lookup table. When using a table lookup as a data type then this is the name of the table that you are looking up. For example, if you want to show a list of available reason codes from the reason code table then you would use table 231 "Reason Code" here.'; - - trigger OnAssistEdit() - begin - if IsLookupField then - Rec.AssistEditLookupTable(); - end; } field("Lookup Field No."; Rec."Lookup Field No.") { Editable = IsLookupField; AboutTitle = 'Lookup Field No.'; AboutText = 'This is the field within the Lookup Table to use for the lookup. For example if you had table 231 "Reason Code" as your lookup table, then you could use from the "Reason Code" table field "1" which represents the field "Code" on that table. When someone is recording an inspection, and choosing the test value they would then see as options the values from this field.'; - - trigger OnAssistEdit() - begin - if IsLookupField then - Rec.AssistEditLookupField(); - end; } field("Lookup Field Name"; Rec."Lookup Field Caption") { Editable = IsLookupField; AboutTitle = 'Lookup Field Name'; AboutText = 'This is the name of the field within the Lookup Table to use for the lookup. For example if you had table 231 "Reason Code" as your lookup table, and also were using field "1" as the Lookup Field (which represents the field "Code" on that table) then this would show "Code"'; - - trigger OnAssistEdit() - begin - if IsLookupField then - Rec.AssistEditLookupField(); - end; } field("Lookup Table Filter"; Rec."Lookup Table Filter") { diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al index b8d83c4597..781f1a91bf 100644 --- a/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al +++ b/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al @@ -83,44 +83,6 @@ codeunit 139965 "Qlty. Tests - More Tests" EntryTypeOutputConditionFilterTok: Label 'WHERE(Entry Type=FILTER(Output))', Locked = true; PassFailQuantityInvalidErr: Label 'The %1 and %2 cannot exceed the %3. The %3 is currently exceeded by %4.', Comment = '%1=the passed quantity caption, %2=the failed quantity caption, %3=the source quantity caption, %4=the quantity exceeded'; - [Test] - [HandlerFunctions('LookupTableModalPageHandler_FirstRecord')] - procedure TestCardPage_AssistEditLookupTable() - var - AllObjWithCaption: Record AllObjWithCaption; - ToLoadQltyTest: Record "Qlty. Test"; - QltyTestCard: TestPage "Qlty. Test Card"; - TestCode: Text; - begin - // [SCENARIO] User can use AssistEdit to select a lookup table for a Table Lookup test value type - Initialize(); - - // [GIVEN] A random test code is generated - QltyInspectionUtility.GenerateRandomCharacters(20, TestCode); - - // [GIVEN] A new quality test with Test Value Type "Table Lookup" is created - ToLoadQltyTest.Validate(Code, CopyStr(TestCode, 1, MaxStrLen(ToLoadQltyTest.Code))); - ToLoadQltyTest.Validate(Description, LibraryUtility.GenerateRandomText(MaxStrLen(ToLoadQltyTest.Description))); - ToLoadQltyTest.Validate("Test Value Type", ToLoadQltyTest."Test Value Type"::"Value Type Table Lookup"); - ToLoadQltyTest.Insert(); - - // [GIVEN] The Quality Test Card page is opened and navigated to the test - QltyTestCard.OpenEdit(); - QltyTestCard.GoToRecord(ToLoadQltyTest); - - // [WHEN] AssistEdit is invoked on the "Lookup Table No." field - QltyTestCard."Lookup Table No.".AssistEdit(); - QltyTestCard.Close(); - - // [THEN] The first table from AllObjWithCaption is selected via modal handler - AllObjWithCaption.SetRange("Object Type", AllObjWithCaption."Object Type"::Table); - AllObjWithCaption.FindFirst(); - - // [THEN] The test's Lookup Table No. is updated with the selected table ID - ToLoadQltyTest.Get(ToLoadQltyTest.Code); - LibraryAssert.AreEqual(AllObjWithCaption."Object ID", ToLoadQltyTest."Lookup Table No.", 'Should be same table no.') - end; - [Test] procedure TestTable_ValidateExpressionFormula() var @@ -499,44 +461,6 @@ codeunit 139965 "Qlty. Tests - More Tests" LibraryAssert.AreEqual(Vendor.FieldNo("No."), ToLoadQltyTest."Lookup Field No.", 'Should be same lookup field no.'); end; - [Test] - [HandlerFunctions('FieldsLookupModalPageHandler')] - procedure TestTable_AssistEditLookupField() - var - ToLoadQltyTest: Record "Qlty. Test"; - Vendor: Record Vendor; - QltyTestCard: TestPage "Qlty. Test Card"; - TestCode: Text; - begin - // [SCENARIO] User can use AssistEdit to select a field from the lookup table (e.g., select Vendor "No." field) - Initialize(); - - // [GIVEN] A random test code is generated - QltyInspectionUtility.GenerateRandomCharacters(20, TestCode); - - // [GIVEN] A new quality test with Test Value Type "Table Lookup" targeting Vendor table is created - ToLoadQltyTest.Validate(Code, CopyStr(TestCode, 1, MaxStrLen(ToLoadQltyTest.Code))); - ToLoadQltyTest.Validate(Description, LibraryUtility.GenerateRandomText(MaxStrLen(ToLoadQltyTest.Description))); - ToLoadQltyTest.Validate("Test Value Type", ToLoadQltyTest."Test Value Type"::"Value Type Table Lookup"); - ToLoadQltyTest.Validate("Lookup Table No.", Database::Vendor); - ToLoadQltyTest.Insert(); - - // [GIVEN] The Quality Test Card page is opened and navigated to the test - QltyTestCard.OpenEdit(); - QltyTestCard.GoToRecord(ToLoadQltyTest); - - // [GIVEN] The Vendor "No." field name is prepared for selection via modal handler - ChooseFromLookupValue := Vendor.FieldName("No."); - - // [WHEN] AssistEdit is invoked on the "Lookup Field No." field - QltyTestCard."Lookup Field No.".AssistEdit(); - QltyTestCard.Close(); - - // [THEN] The test's Lookup Field No. is updated with the Vendor "No." field number - ToLoadQltyTest.Get(ToLoadQltyTest.Code); - LibraryAssert.AreEqual(Vendor.FieldNo("No."), ToLoadQltyTest."Lookup Field No.", 'Should be same lookup field no.'); - end; - [Test] procedure SetupTable_ValidateAdditionalPictureHandling() var