Home > Expression Operators > Date Operators > #BCDATE > What benefit commence dates are available?

What benefit commence dates are available?

If you are not using Calculated Dates to create or limit Benefit Commencement Dates, you can use #BCDATE 99 to return the array of Benefit Commencement Dates. This will work in a Data Default expression and any expression where #DATE is available.

If you are using Calculated Dates to create or limit Benefit Commencement Dates, then using #BCDATE in a data default expression only returns the initial set of Benefit Commencement Dates, and doesn’t include any Benefit Commencement Dates created by Calculated Dates (and may include Benefit Commencement Dates that would be eliminated by Calculated Dates).

Data Default expressions

In a data default, we could use the following expressions to get all the non-Calculated Dates Benefit Commencement Dates, and then we could count them:

BCDs_DT:= #BCDATE 99 & ; get all the non-Calculated Dates related Benefit Commencement Dates
B:= BCDs_DT > 0 & ; get ready to count them: B contains a 1 for each BCD
S:= 0 #MPSUM B & ; accumulate the BCD indicators
Count:= #GETVALUE S & ; get the last non-zero value (which is the number of BCDs)

Service and Salary transformation expressions 

In service and salary transformation expressions, we can do something similar, but here we need to account for the set of calculation dates (i.e., #DATE):

BCDs_DT:= #BCDATE 99 & ; get all the Benefit Commencement Dates (a date for each calculation date; zero until the first BCD)
B:= BCDs_DT = #DATES & ; indicates which calculation dates are BCDs (B is mostly zeros, with a 1 at each BCD)
S:= 0 #MPSUM B & ; accumulate the BCD indicators
Count:= #GETVALUE S & ; get the last non-zero value (which is the number of BCDs)
The only problem with this approach is that if you are using events, then you may not get all the BCDs because only subsets of the set of calculation dates are used for each event.

Now, all other expressions where #DATE is available 

In these types of expressions, many array functions are NOT available (e.g., #MPSUM, #INARRAY, …). That makes it harder to determine how many Benefit Commencement Dates we have. However, it is quite easy to determine which calculation dates are Benefit Commencement Dates:

BCDs_DT:= #BCDATE 99 & ; get all the Benefit Commencement Dates (a date for each calculation date; zero until the first BCD)
B:= BCDs_DT = #DATES & ; indicates which calculation dates are BCDs (B is mostly zeros, with a 1 at each BCD)

Because #MPSUM is NOT available, it becomes cumbersome to determine how many Benefit Commencement dates we have:

; This expression assumes we don’t have more than 10 Benefit Commencement Dates. You could
; create an User Error/Warning to indicate that there are more than 10 BCDs

; get all the BCDs and then walk backwards from the last BCD to the first to count the number of BCDs

BCDs_DT:= #BCDATE 99 & ; get all the Benefit Commencement Dates (a date for each calculation date; zero until the first BCD)

b01_DT:= BCDs_dt * (BCDs_dt = #DATE) & ; 0 (i.e., 1/1/1900) and BCDs dates (where the calculation date is a bcd)
v01:= 0 < #GETVALUE b01_DT & ; zero or the bcd associated with the last non-zero value in b01_dt (the last bcd)

b02_dt:= b01_dt * (b01_dt <> #GETVALUE b01_dt) & ; eliminate the last bcd in b01_dt (the last bcd)
v02:= 0 < #GETVALUE b02_DT & ; zero or the value associated with the last non-zero value in b02_dt (the 2nd to last bcd)

b03_dt:= b02_dt * (b02_dt <> #GETVALUE b02_dt) & ; eliminate the last bcd in b02_dt (the 2nd to last bcd)
v03:= 0 < #GETVALUE b03_DT & ; zero or the value associated with the last non-zero value in b03_dt (the 3rd to last bcd)

b04_dt:= b03_dt * (b03_dt <> #GETVALUE b03_dt) & ; eliminate the last bcd in b03_dt (the 3rd to last bcd)
v04:= 0 < #GETVALUE b04_DT & ; zero or the value associated with the last non-zero value in b04_dt (the 4th to last bcd)

b05_dt:= b04_dt * (b04_dt <> #GETVALUE b04_dt) & ; eliminate the last bcd in b04_dt (the 4th to last bcd)
v05:= 0 #GETVALUE b05_DT  & ; zero or the value associated with the last non-zero value in b05_dt (the 5th to last bcd)

b06_dt:= b05_dt * (b05_dt <> #GETVALUE b05_dt) & ; eliminate the last bcd in b05_dt (the 5th to last bcd)
v06:= 0 #GETVALUE b06_DT & ; zero or the value associated with the last non-zero value in b06_dt (the 6th to last bcd)

b07_dt:= b06_dt * (b06_dt <> #GETVALUE b06_dt) & ; eliminate the last bcd in b06_dt (the 6th to last bcd)
v07:= 0 #GETVALUE b07_DT & ; zero or the value associated with the last non-zero value in b07_dt (the 7th to last bcd)

b08_dt:= b07_dt * (b07_dt <> #GETVALUE b07_dt) & ; eliminate the last bcd in b07_dt (the 7th to last bcd)
v08:= 0 #GETVALUE b08_DT & ; zero or the value associated with the last non-zero value in b08_dt (the 8th to last bcd)

b09_dt:= b08_dt * (b08_dt <> #GETVALUE b08_dt) & ; eliminate the last bcd in b08_dt (the 8th to last bcd)
v09:= 0 #GETVALUE b09_DT & ; zero or the value associated with the last non-zero value in b09_dt (the 9th to last bcd)

b10_dt:= b09_dt * (b09_dt <> #GETVALUE b09_dt) & ; eliminate the last bcd in b09_dt (the 9th to last bcd)
v10:= 0 #GETVALUE b10_DT & ; zero or the value associated with the last non-zero value in b10_dt (the 10th to last bcd)


count:= v01 + v02 + v03 + v04 + v05 + v06 + v07 + v08 + v09 + v10  &