Hi i am trying to calculate the sync duration but issue is that its display last value in every row.
IF "WMS Activity Log".FIND('-') THEN REPEAT
IF "WMS Activity Log"."Action Type" = 'SyncStart' THEN BEGIN
CurrentUser := "WMS Activity Log"."User ID";
StartTime := "WMS Activity Log"."Date Time";
IF "WMS Activity Log".FIND('>') THEN
IF "WMS Activity Log"."Action Type" = 'SyncEnd'THEN
If NextUser = CurrentUser then
NextUser := "WMS Activity Log"."User ID";
EndTime := "WMS Activity Log"."Date Time";
TotalDuration := EndTime - StartTime;
END;
UNTIL ("WMS Activity Log".NEXT =0);
0
Answers
IF ( "WMS Activity Log"."Action Type" = 'SyncStart') AND (CurrentUser <> "WMS Activity Log"."User ID" ) THEN BEGIN
CLEAR(StartTime);
CLEAR(TotalDuration);
CurrentUser := "WMS Activity Log"."User ID";
StartTime := "WMS Activity Log"."Date Time";
WMSActivityTemp.INIT;
WMSActivityTemp.ID := "WMS Activity Log".ID;
WMSActivityTemp."User ID" := "WMS Activity Log"."User ID";
WMSActivityTemp.TotalDuration := TotalDuration;
WMSActivityTemp."Action Type" := "WMS Activity Log"."Action Type";
WMSActivityTemp.INSERT;
END;
IF ("WMS Activity Log"."Action Type" = 'SyncEnd') AND ("WMS Activity Log"."User ID" = CurrentUser) THEN BEGIN
WMSActivityTemp.INIT;
WMSActivityTemp.ID := "WMS Activity Log".ID;
WMSActivityTemp."User ID" := "WMS Activity Log"."User ID";
WMSActivityTemp.TotalDuration := "WMS Activity Log"."Date Time" - StartTime;
WMSActivityTemp."Action Type" := "WMS Activity Log"."Action Type";
WMSActivityTemp."Device ID" := "WMS Activity Log"."Device ID";
WMSActivityTemp."Date Time" := StartTime;
WMSActivityTemp.Value := "WMS Activity Log".Value;
WMSActivityTemp.INSERT;
CLEAR(CurrentUser);
END;