Skip to content

Commit

Permalink
Fix issue where RecRef.Next() cant retrieve first record with empty p…
Browse files Browse the repository at this point in the history
…rimary key value (setup records)

Use findset for first record reading iteration
Test for setup record
  • Loading branch information
Drakonian committed Mar 6, 2025
1 parent 4ae9092 commit 9c0553d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Source/Codeunits/Cod81002.DETReadDataBatch.al
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ codeunit 81002 "DET Read Data Batch"
if GuiAllowed() then
ConfigProgressBar.Init(TotalCount, 1, RecRef.Caption());

RecRef.Next(StartIndex);
if StartIndex = 1 then
RecRef.FindSet()
else
RecRef.Next(StartIndex);

repeat
Counter := 0;
TempDataEditorBufferRecRef.Init();
Expand Down
2 changes: 1 addition & 1 deletion Source/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "e28d62da-ceb0-46e7-9e06-774bc46f4bac",
"name": "Data Editor Tool",
"publisher": "Volodymyr Dvernytskyi",
"version": "4.0.0.4",
"version": "4.0.0.5",
"brief": "https://vld-bc.com/",
"description": "https://vld-bc.com/",
"privacyStatement": "https://vld-bc.com/",
Expand Down
30 changes: 30 additions & 0 deletions Test/Tests/Cod81101.TDETBasicOperations.al
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ codeunit 81101 "TDET Basic Operations"
Assert: Codeunit "Library Assert";
CustomerNo1, CustomerNo2 : Code[20];

[Test]
[TransactionModel(TransactionModel::AutoRollback)]
procedure LoadTableCompanyInformation()
var
CompanyInformation: Record "Company Information";
DataEditorBufferTestMode: Codeunit "TDET DE Buffer Test Mode";
DataEditor: TestPage "DET Data Editor";
DataEditorBuffer: TestPage "DET Data Editor Buffer";
ListOfRecorIds: List of [RecordId];
FieldNoFilter: List of [Integer];
begin
Init();
CompanyInformation.Get();

ListOfRecorIds.Add(CompanyInformation.RecordId());

DataEditorBuffer.Trap();

DataEditor.OpenEdit();
DataEditor.SourceTableNoField.SetValue(Database::"Company Information");
DataEditor.ExcludeFlowFieldsField.SetValue(false);
BindSubscription(DataEditorBufferTestMode);
DataEditor.OK().Invoke();
UnbindSubscription(DataEditorBufferTestMode);

Assert.AreEqual(CompanyInformation.TableCaption(), DataEditorBuffer.Caption(), '');

LibraryDataEditor.VerifyBufferFieldsWithSourceRecord(DataEditorBuffer, ListOfRecorIds, FieldNoFilter, false);
end;

[Test]
[TransactionModel(TransactionModel::AutoRollback)]
procedure LoadTableCustomer()
Expand Down
Binary file modified Test/Volodymyr Dvernytskyi_Data Editor Tool - Tests_1.0.0.0.app
Binary file not shown.
Binary file modified Volodymyr Dvernytskyi_Data Editor Tool_Latest.app
Binary file not shown.

0 comments on commit 9c0553d

Please sign in to comment.