ITsCalendarSettings.WorkDayCount

Fore Syntax

WorkDayCount: Integer;

Fore.NET Syntax

WorkDayCount: integer;

Description

The WorkDayCount property returns the number of working days in a week.

Comments

The property is relevant for series with daily calendar frequency. The value of WorkDayCount is calculated as seven minus the number of days from the ITsCalendarSettings.RestDays property.

Fore Example

This example displays a custom series calculation method. To execute the example, add links to the Dimensions, Ms, Transform system assemblies.

Function WorkDayCount(Input: ITimeSeries): Variant;
Var
    pContext: ITsCalculationContext;
    i: Integer;
    pSeries: ITimeSeries;
    CalendSett: ITsCalendarSettings;
Begin
    pContext := TsCalculation.Current;
    pSeries := pContext.CreateTimeSeries(DimCalendarLevel.Day);
    CalendSett := pContext.CalendarSettings;
    If (CalendSett.WorkDayCount = 5And (CalendSett.FirstDay = DayOfWeekSet.Monday) Then
        For i := Input.StartIndex To Input.EndIndex Do
            pSeries.Item(i) := 1 + Input.Item(i);
        End For;
    Else
        pContext.RaiseWarning("Used calendar parameters do not fit for method calculation");
    End If;
    Return pSeries;
End Function WorkDayCount;

The method increases input series values if the custom calculation method context is set on a five-day week and Monday is the beginning of the week.

Fore.NET Example

The example displays a custom series calculation method.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Transform;

Public Function WorkDayCountNet(Input: ITimeSeries): object;
Var
    TsCalc: TsCalculation;
    pContext: ITsCalculationContext;
    i: Integer;
    pSeries: ITimeSeries;
    CalendSett: ITsCalendarSettings;
Begin
    TsCalc := New TsCalculation.Create();
    pContext := TsCalc.Current[Null];
    pSeries := pContext.CreateTimeSeries(-1 As DimCalendarLevel, NullAs ITimeSeries;
    CalendSett := pContext.CalendarSettings[Null];
    If (CalendSett.WorkDayCount = 5And (CalendSett.FirstDay = DayOfWeekSet.dowsMonday) Then
        For i := Input.StartIndex To Input.EndIndex Do
            pSeries.Item[i] := 1 + (Input.Item[i] As double);
        End For;
    Else
        pContext.RaiseWarning("Used calendar parameters do not fit for method calculation");
    End If;
    Return pSeries;
End Function WorkDayCountNet;

The method increases input series values if the custom calculation method context is set on a five-day week and Monday is the beginning of the week.

See also:

ITsCalendarSettings