Skip to main content

Program indicator engine

The SDK includes its own Program Indicator engine for the evaluation of in-line Program Indicators. These kind of indicators are evaluated within the context of an enrollment or an event (single or tracker) and they are usually placed in the data entry form offering additional information to the data encoder. This means that, even though they are regular Program Indicators and can be calculated across enrollments, they have provide useful information within a single enrollment.

A good example, "Average time between visits".

A bad example, "Number of active TEIs": it would always be 1.

In order to trigger the Program Indicator Engine, just execute:

d2.programModule()
.programIndicatorEngine()
.getEnrollmentProgramIndicatorValue(enrollment-uid>, program-indicator-uid>);

d2.programModule()
.programIndicatorEngine()
.getEventProgramIndicatorValue(event-uid>, program-indicator-uid>);

If the evaluation of the "filter" component returns false, the result is null.

Table: Compatibility

TypeElementWebAndroid SDK
Mathematical:ParenthesisYesYes
Plus (+)YesYes
Minus (-)YesYes
Power (^)YesYes
Multiply (*)YesYes
Divide (/)YesYes
Modulus (%)YesYes
Logical:NOTYesYes
!YesYes
ANDYesYes
&&YesYes
ORYesYes
||YesYes
Comparison:Equal (==)YesYes
NotEqual (!=)YesYes
GT (>)YesYes
LT ()YesYes
GE (>=)YesYes
LE ()YesYes
Functions:FirstNonNullYesYes
GreatestYesYes
IfYesYes
IsNotNullYesYes
IsNullYesYes
LeastYesYes
LogYesYes
Log10YesYes
PeriodOffset-No
D2 functions:D2AddDaysYesYes
D2CeilYesYes
D2ConcatenateYesYes
D2ConditionYesYes
D2CountYesYes
D2CountIfConditionYesYes
D2CountIfValueYesYes
D2DaysBetweenYesYes
D2FloorYesYes
D2HasValueYesYes
D2LeftYesYes
D2LengthYesYes
D2MaxValueNoYes
D2MinutesBetweenYesYes
D2MinValueNoYes
D2ModulusYesYes
D2MonthsBetweenYesYes
D2OizpYesYes
D2RelationshipCountYesYes
D2RightYesYes
D2RoundYesYes
D2SplitYesYes
D2SubstringYesYes
D2ValidatePatternYesYes
D2WeeksBetweenYesYes
D2YearsBetweenYesYes
D2ZingYesYes
D2ZpvcYesYes
D2LastEventDateYesNo
D2AddControlDigitsYesNo
D2CheckControlDigitsYesNo
D2ZScoreWFAYesNo
D2ZScoreWFHYesNo
D2ZScoreHFAYesNo
D2InOrgUnitGroupYesNo
D2HasUserRoleYesNo
Variables:AnalyticsPeriodEndNoNo
AnalyticsPeriodStartNoNo
CreationDateNoYes
CurrentDateYesYes
CompletedDateNoYes
DueDateYesYes
EnrollmentCountYesYes
EnrollmentDateYesYes
EnrollmentStatusNoYes
EventStatusYesYes
EventCountYesYes
ExecutionDateYesYes
EventDateYesYes
IncidentDateYesYes
OrgunitCountNoNo
ProgramStageIdYesYes
ProgramStageNameYesYes
SyncDateNoNo
TeiCountYesYes
ValueCountYesYes
ZeroPosValueCountYesYes
Other:ConstantYesYes
ProgramStageElementYesYes
ProgramAttributeYesYes
PS_EVENTDATEYesYes