Hi,
As shown in the image i want the find count of sales order between ( from 7am to 7pm) and I want count for sales order between one hours like (7am-8am) how can be done
Please help in Al code if possible
procedure hrorderpacked()
var
rec_SalesShipmentHeader: Record "Sales Shipment Header";
rec_HourordersPackedByPacker: Record "Hour Order packed";
rec_User: Record User;
curr_Time1: DateTime;
curr_Time2: DateTime;
Diff_Duration: Duration;
begin
if rec_User.FindSet()
then
repeat
rec_SalesShipmentHeader.SetCurrentKey(SystemCreatedAt);
rec_SalesShipmentHeader.SetAscending(SystemCreatedAt, true);
//rec_SalesShipmentHeader.SetRange("Posting Date", Today - 31, Today);
rec_SalesShipmentHeader.SetRange("User ID", rec_User."User Name");
if rec_SalesShipmentHeader.FindSet()
then
repeat
rec_HourordersPackedByPacker.SetRange(Username, rec_User."User Name");
if rec_HourordersPackedByPacker.findSet() then begin
case (rec_SalesShipmentHeader.SystemCreatedAt) of
CurrentDateTime - 3600000 / 7:
rec_HourordersPackedByPacker.Before7AM := rec_HourordersPackedByPacker.Before7AM + 1;
end;
end;
This code is what I tried, please help in this one.
Thankyou.
Not getting the expected result is there any more suggestions in Al code where I can get the last hour post sales shipment count?
2) how can get total count? For last hours
Please help in this as also?.
As I am beginner in business Central.
Thankyou.
Ok, Thankyou, and also can check last hour with current time? Right?
You can use above procedure CountBetween7to8() by changing DT and DT2 variable value to last hour start and end time. example if your last hour is 7pm to 8 pm then add it to DT and DT2.
Here I want to only show count of sales order for last hour only now show how to check that ?
Thankyou
You can make this process dynamic by increasing Date time by one hour. Or simple you can create separate procedure for each hour.
Hi, this example is ok but as shown in image I want to find hour break down, that is one hour break down from 7AM to 7PM how that can be done but?
For each hour difference how can be done ? Can you give some example for that.
Thankyou.
This is simple example to calculate count between 7 am to 8 am
local procedure CountBetween7to8()
var
Rec_SalesHeader: Record "Sales Header";
DT: DateTime;
DT2: DateTime;
CountBetwee7to8: Integer;
begin
DT := CreateDateTime(Today, 070000T);
DT2 := CreateDateTime(Today, 080000T);
Rec_SalesHeader.SetRange(SystemCreatedAt, DT, DT2);
CountBetwee7to8 := Rec_SalesHeader.Count;
end;
But,This is to summarise only count, but I want to display count between hours i e (7am-8am) ,between this i want to count so how can we do that.
Thankyou
Hi, It looks like you want to summarize the data on one line, hope the following information can give you some hints.
Thanks.
ZHU
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156