local procedure TestNumberIncrementFindLast()
var
ListOfText: List of [Text];
StartDateTime: DateTime;
DummyEntryNo: Integer;
i: Integer;
begin
if not IsEntryTableReady then
Error('You must Init Entry Table before you go.');
StartDateTime := CurrentDateTime();
for i := 1 to NumberOfIterations do begin
DummyEntryNo := SimulateGetNextEntryNo(i - 1);
ListOfText.Add(Format(i));
end;
Message('Number increment: %1 iterations took %2.', NumberOfIterations, CurrentDateTime() - StartDateTime);
end;
local procedure SimulateGetNextEntryNo(CurrentCounter: Integer): Integer
var
EntryTable: Record "NSP Entry Table";
begin
EntryTable.SetRange("Entry No.", CurrentCounter);
if EntryTable.FindLast() then
exit(EntryTable."Entry No." + 1);
exit(1);
end;
local procedure TestAutoIncrementInsertRecord()
var
EntryTable2: Record "NSP Entry Table2";
StartDateTime: DateTime;
i: Integer;
begin
if not IsEntryTableReady then
Error('You must Init Entry Table before you go.');
StartDateTime := CurrentDateTime();
for i := 1 to NumberOfIterations do begin
EntryTable2.Init();
EntryTable2."Entry No." := 0;
EntryTable2.Description := 'test';
EntryTable2.Insert();
end;
Message('Auto Increment on Insert: %1 iterations took %2.', NumberOfIterations, CurrentDateTime() - StartDateTime);
end;
traces
| where timestamp > ago(1h)
| where customDimensions.eventId == 'RT0018'
| where customDimensions.clientType == "WebClient"
| where customDimensions.environmentName == "DEV"
| where customDimensions.companyName == "DEV"
| project
timestamp
,
companyName = customDimensions.companyName
,
alMethod = customDimensions.alMethod
,
executionTimeInMs = toreal(totimespan(customDimensions.executionTime)) / 10000
,
sqlExecutes = customDimensions.sqlExecutes
,
sqlRowsRead = customDimensions.sqlRowsRead
SELECT TOP (1) "309"."timestamp",
"309"."Series Code",
"309"."Line No_",
"309"."Starting Date",
"309"."Starting No_",
"309"."Ending No_",
"309"."Warning No_",
"309"."Increment-by No_",
"309"."Last No_ Used",
"309"."Open",
"309"."Last Date Used",
"309"."Allow Gaps in Nos_",
"309"."Sequence Name",
"309"."Starting Sequence No_",
"309"."Series",
"309"."Authorization Code",
"309"."Authorization Year",
"309"."$systemId",
"309"."$systemCreatedAt",
"309"."$systemCreatedBy",
"309"."$systemModifiedAt",
"309"."$systemModifiedBy"
FROM "db_bcprodus_t81151820_20240123_07045562_df96".dbo."DEV$No_ Series Line$437dbf0e-84ff-417a-965d-ed2bb9650972" "309" WITH(UPDLOCK)
WHERE ("309"."Series Code"=@0
AND "309"."Starting Date"=@1
AND "309"."Open"=@2)
ORDER BY "Series Code" ASC,
"Starting Date" ASC,
"Starting No_" ASC,
"Line No_" ASC OPTION(OPTIMIZE
FOR UNKNOWN, FAST 50)
UPDATE "db_bcprodus_t81151820_20240123_07045562_df96".dbo."DEV$No_ Series Line$437dbf0e-84ff-417a-965d-ed2bb9650972"
SET "Last No_ Used"=@0,
"$systemModifiedAt"=@1,
"$systemModifiedBy"=@2 OUTPUT inserted."timestamp"
WHERE ("Series Code"=@3
AND "Line No_"=@4
AND "timestamp"=@5)
SELECT "81751"."timestamp",
"81751"."Entry No_",
"81751"."Description",
"81751"."$systemId",
"81751"."$systemCreatedAt",
"81751"."$systemCreatedBy",
"81751"."$systemModifiedAt",
"81751"."$systemModifiedBy"
FROM "db_bcprodus_t81151820_20240123_07045562_df96".dbo."DEV$NSP Entry Table$53b8213d-c4d8-429c-b4cf-168ec4470685" "81751" WITH(READUNCOMMITTED)
WHERE ("81751"."Entry No_"=@0) OPTION(OPTIMIZE
FOR UNKNOWN, FAST 50)
SELECT NEXT VALUE
FOR dbo.[$SEQ$NumberSequence$EA9B2114-5ECB-40A6-AF53-124F75ED0B92$DEV]
SELECT NEXT VALUE
FOR dbo.[$SEQ$NumberSequence$NSP_NumberSequence$DEV]
CREATE SEQUENCE dbo.[$SEQ$NumberSequence$NSP_NumberSequence$DEV] AS BIGINT
START WITH 0 INCREMENT BY 1 NO CACHE
CREATE SEQUENCE dbo.[$SEQ$NumberSequence$PERFORMANCETESTCACHE$CRONUS USA, Inc_] AS BIGINT
START WITH 0 INCREMENT BY 1 CACHE 100