Mailed Two or More Consecutive Sets of Benefits (PDF)

Report Overview
•••
This report has three tabs. The first tab lists
participants who were mailed two or more
consecutive sets of benefits during the specified
time period by the specified agency. The second
Mailed Two or
More Consecutive
Sets of Benefits
tab is an Excel format-friendly version of the
Infoview Report Template Guidance –
information provided in Tab 1. The last tab is a
BENEFITS & REDEMPTION
count of the number of sets of benefits mailed.
Tab 1 – Mailed Benefits: List of participants
issued two or more consecutive sets of benefits,
including the participant’s WIC Type, high risk
status, the participation month, issued date,
redemption dates (if applicable), the Staff ID of
the person who issued the benefits and the
agency/clinic where issued; grouped by
Household ID and State WIC ID.
Tab 2 – Simple Format: An Excel-friendly
ungrouped listing of the same information
provided in Tab 1.
Tab 3 – Count: A count of the number of
consecutive sets of mailed benefits by State WIC
ID and a total count of households and
participants mailed benefits during the specified
time period.
Notes
*Only participants issued more than one consecutive
sets of benefits will display in the report output. This
report does NOT provide a listing of all participants
mailed benefits during the specified time period.
*A participant’s High Risk status is not recorded at the
time of issuance. For this report output, whether a
participant is high risk is dependent on their status as of
their most recent certification (NOTE: this does not
include changes to high risk status that may have
occurred due to pseudo-certs).
*The Paid Date(s) column in Tab 1 – Mailed Benefits
indicates that at least one benefit from the benefit set
was redeemed. If benefits from the same set were
redeemed on different dates, all redemption dates
associated with the benefit set will display.
*Multiple rows display in Tab 2 - Simple Format if the
participant has redeemed their benefits on multiple dates or has had a least one redeemed and one
unredeemed benefit for the same participation month.
*The WIC Type is based on the participant’s WIC Type at the time of issuance. This may not reflect the
participant’s current WIC Type.
*The Agency ID and Clinic ID are based on the agency/clinic where the benefits were issued. This may not
reflect the participant’s the agency/clinic to which the participant currently belongs.
1|Page
MN Department of Health WIC Program
Mailed Two or More Consecutive Sets of Benefits
•••
Tab 1 – Mailed Benefits
Tab 2 – Simple Format
Tab 3 – Count
Prompt(s)
TABLE
FIELD
OPERATOR
VALUE
PROMPT/DEFINITION
Enter 3-digit Agency ID.
FOODINSTRUMENTSET
Agencyid
Equal to
###
The agency where the benefits
mailed were issued.
Enter Start Date.
FOODINSTRUMENTSET
Createdttm
Between
mm/dd/yy
The first date in the time period
during which the benefits were
issued.
Enter End Date.
FOODINSTRUMENTSET
2|Page
Createdttm
And
mm/dd/yy
The last date in the time period
during which the benefits were
issued.
Mailed Two or More Consecutive Sets of Benefits
•••
Static Criteria
Mailed Benefits
FOODINSTRUMENTSET. Mailed Equal to Y
Explanation: Include only benefits that have been mailed
FOODINSTRUMENTSET.Statewicid In List More than One Set Query
Explanation: Include only those participants identified as having been mailed more than one set of benefits in
the More than One Set query
SQL (Sub-Query in FROM statement): (SELECT dbo.FOODINSTRUMENTSET.Foodinstrumentsetid,
dbo.FOODINSTRUMENTSET.Statewicid, dbo.FOODISNTRUMENSET.Participationdate FROM
dbo.FOODINSTRUMENSET WHERE dbo.FOODINSTRUMENTSET.Mailed = ‘Y’) as Mailed_Qry INNER
JOIN dbo.FOODINSTRUMENTSET ON (dbo.FOODINSTRUMENTSET.Statewicid=Mailed_Qry.
Statewicid
Explanation: Identify sub-group of participation dates in which the benefits were mailed in order to be able to
compare these participation dates to the months before and after (allows determination of consecutive months)
SQL (WHERE): CONVERT(date, dbo.FOODINSTRUMENSET.Createdttm, 101)
Explanation: Remove time stamp from the Createddtm, otherwise, the last date in the date range is not
included in the report output
SQL (WHERE): dbo.CERTCONTACT.Certstartdate = dbo.MEMBER.Certstartdate
Explanation: Use the most recent certification record (necessary for obtaining the High Risk status)
SQL (WHERE): dbo.CERTCONTACT.Certstartdate = dbo.CERTCONTACT.Certeffectivedate
Explanation: Exclude certification records created by pseudo-certs (necessary for obtaining the High Risk
status)
SQL (WHERE): (Convert(datetime,dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE+'01',112)=
Dateadd(month, 1, convert(datetime,Mailed_Qry.Participationdate+'01',112))
OR
Convert(datetime,dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE+'01',112)=Dateadd(month,-1,
convert(datetime,Mailed_Qry.Participationdate+'01',112))))
Explanation: Convert the Participationdate (and Mailed_Qry.Participationdate) from a string to a date then
change the format from YYYYMM to YYYYMM0; include the participation month if the month before and/or
the month after were also mailed
3|Page
Mailed Two or More Consecutive Sets of Benefits
•••
Mailed Benefits
FOODINSTRUMENTSET. Mailed Equal to Y
Explanation: Include only benefits that have been mailed
SQL (SELECT): COUNT(DISTINCT dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID)
Explanation: Count the number of Foodinstrumentsetid records
SQL (GROUP BY): HAVING COUNT (DISTINCT dbo.FOODINSTRUMENTSET.
FOODINSTRUMENTSETID) >= ‘2’
Explanation: Only include records where more than one set of benefits were mailed
Consecutive Sets
FOODINSTRUMENTSET. Mailed Equal to Y
Explanation: Include only benefits that have been mailed
FOODINSTRUMENTSET. Foodinstrumentsetid In List Mailed Benefits Query
Explanation: Include only those benefits sets identified as meeting the criteria in the Mailed Benefits query
SQL (SELECT): COUNT(DISTINCT dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID)
Explanation: Count the number of Foodinstrumentsetid records
Tab 1 – Mailed Benefits
Columns
•
•
•
•
•
•
•
•
•
WIC Type (FOODINSTRUMENTSET.Wictype)
High Risk (CERTCONTACT.Highrisk)
PPTN Mo. (FOODINSTRUMENTSET.Participationdate)
Issue Date (FOODISNTRUMENTSET.Issueddate)
Mailed (FOODINSTRUMENTSET.Mailed)
Paid Date(s)  See VARIABLES ([VAR Paiddate])
Staff ID (FOODINSTRUMENTSET.Createuserid)
Ag. ID (FOODINSTRUMENTSET.Agencyid)
Cl. ID (FOODINSTRUMENTSET.Servicesiteid)
Sorted by
Participation Month (Ascending)
Grouped by
•
•
Household ID (MEMBER.Householdid)  Ascending
State WIC ID (FOODINSTRUMENTSET.Statewicid)  Ascending
4|Page
Mailed Two or More Consecutive Sets of Benefits
•••
Tab 2 – Simple Format
Columns
•
•
•
•
•
•
•
•
•
•
•
Household ID (MEMBER.Householdid)
State WIC ID (FOODINSTRUMENTSET.Statewicid)
WIC Type (FOODINSTRUMENTSET.Wictype)
High Risk (CERTCONTACT.Highrisk)
PPTN Mo. (FOODINSTRUMENTSET.Participationdate)
Issue Date (FOODISNTRUMENTSET.Issueddate)
Mailed (FOODINSTRUMENTSET.Mailed)
Paid Date(s) (FOODINSTRUMENT.Paiddate)
Staff ID (FOODINSTRUMENTSET.Createuserid)
Ag. ID (FOODINSTRUMENTSET.Agencyid)
Cl. ID (FOODINSTRUMENTSET.Servicesiteid)
Sorted by
•
•
Household ID (Ascending)
State WIC ID (Ascending)
Tab 3 – Count
Columns
•
•
•
Household ID (MEMBER.Householdid)
State WIC ID (FOODINSTRUMENTSET.Statewicid)
# of Consecutive Sets of Mailed Benefits ([Consecutive Sets].[Foodinstrumentsetid])
Sorted by
•
•
Household ID (Ascending)
State WIC ID (Ascending)
Counts
•
•
Householdid (Distinct)
State WIC ID (Distinct)
5|Page
Mailed Two or More Consecutive Sets of Benefits
•••
Technical Notes
Notes
The More than One Set query identifies the participants that have more than one set of mailed benefits. The Mailed
Benefits query then uses only those State WIC IDs identified in More than One Set query so that only participants with
more than one set of benefits is listed in the report output.
A sub-query was used in the Mailed Benefits query. This allows the Participationdate to be compared to itself by creating
another value (Mailed_Qry.Participationdate) to which to compare the FOODINSTRUMENTSET.Particpationdate in
order to identify consecutive months of mailed benefits.
The Consecutive Sets query is necessary in order to be able to count the number of consecutive months of mailed
benefits in Tab 3 - Counts. The More than One Set query cannot be used since it has another function – to limit the records
to those that have more than one set of mailed benefits.
When pulling the High Risk status, duplicate rows were displaying when participants had both a High Risk = Y and
High Risk = N status associated with the certification due to pseudo-certs. In order to eliminate these duplicate rows,
the Certstartdate was made equal to both the MEMBER.Certstartdate and the CERTCONTACT.Certeffectivedate.
The [VAR Paiddate] variable was used to list the Paid Date(s) in one column. Otherwise, a row displayed for each date
redeemed (and individual rows for those with redeemed and unredeemed). The variable identifies the max Paiddate
based in the Participationdate.
The join from the AGENCY table was changed from MEMBER.Agencyid toFOODINSTRUMENTSET.Agencyid since
this is the agency the report outputs are based on.
Variables
[VAR Max Paiddate] =Max([Paiddate]) In ([Participationdate])
[VAR Concat Paiddate] = [Paiddate] + ", " +Previous(Self)
[VAR Max Concat Paiddate] =[VAR Concat Paiddate] Where ([Paiddate] = [VAR Max Paiddate])
[VAR Paiddate] =If(IsNull(Previous([VAR Max Concat Paiddate]));Substr([VAR Max Concat Paiddate];1;Length([VAR
Max Concat Paiddate])-2);Substr([VAR Max Concat Paiddate];1;Pos([VAR Max Concat Paiddate];Previous([VAR Max
Concat Paiddate]))-3))
Formulas
Tab 1 - Mailed Benefits
Agency (report header) = [Mailed Benefits].[Name] + " (" + [Mailed Benefits].[Agencyid] +")"
6|Page
Mailed Two or More Consecutive Sets of Benefits
•••
Report Dates (report header) = (Report Dates: " + FormatDate(ToDate(UserResponse("Enter Start Date:");"M/d/yyyy
hh:mm:ss A");"MM/dd/yyyy") + " - " + FormatDate(ToDate(UserResponse("Enter End Date:");"M/d/yyyy hh:mm:ss
A");"MM/dd/yyyy")
Report Dates (report header) ="Report Dates: " + FormatDate(ToDate(UserResponse("Enter Start Date:");"M/d/yyyy
hh:mm:ss A");"MM/dd/yyyy") + " - " + FormatDate(ToDate(UserResponse("Enter End Date:");"M/d/yyyy hh:mm:ss
A");"MM/dd/yyyy")
Run Date (report header) ="Run Date: " + CurrentDate()
Household ID (group header) ="Household ID " + [Mailed Benefits].[Householdid]
State WIC ID (group header) ="State WIC ID " + [Mailed Benefits].[Statewicid]
Tab 3 – Count
Agency (report header) = [Consecutive Sets].[Name] + " (" + [Consecutive Sets].[Agencyid] + ")"
Report Dates (report header) ="Report Dates: " + FormatDate(ToDate(UserResponse("Enter Start Date:");"M/d/yyyy
hh:mm:ss A");"MM/dd/yyyy") + " - " + FormatDate(ToDate(UserResponse("Enter End Date:");"M/d/yyyy hh:mm:ss
A");"MM/dd/yyyy")
Run Date (report header) ="Run Date: " + CurrentDate()
SQL (changes are highlighted)
Mailed Benefits Query
SELECT
dbo.FOODINSTRUMENTSET.STATEWICID,
dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE,
dbo.FOODINSTRUMENTSET.MAILED,
dbo.FOODINSTRUMENTSET.PRINTEDFDTU,
dbo.FOODINSTRUMENTSET.AGENCYID,
dbo.FOODINSTRUMENTSET.SERVICESITEID,
dbo.FOODINSTRUMENTSET.CREATEUSERID,
dbo.FOODINSTRUMENTSET.CREATEDTTM,
dbo.FOODINSTRUMENT.PAIDDATE,
dbo.FOODINSTRUMENT.SERIALNO,
dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID,
dbo.AGENCY.NAME,
dbo.MEMBER.HOUSEHOLDID,
dbo.CERTCONTACT.HIGHRISK,
dbo.FOODINSTRUMENTSET.WICSTATUS
FROM
(SELECT
dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID,
7|Page
Mailed Two or More Consecutive Sets of Benefits
•••
dbo.FOODINSTRUMENTSET.STATEWICID,
dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE
FROM
dbo.FOODINSTRUMENTSET
WHERE
dbo.FOODINSTRUMENTSET.MAILED = 'Y') as Mailed_Qry
INNER JOIN dbo.FOODINSTRUMENTSET ON (dbo.FOODINSTRUMENTSET.statewicid=Mailed_Qry.Statewicid)
INNER JOIN dbo.MEMBER ON (dbo.MEMBER.STATEWICID=dbo.FOODINSTRUMENTSET.STATEWICID)
INNER JOIN dbo.FOODINSTRUMENT ON
(dbo.FOODINSTRUMENT.FOODINSTRUMENTSETID=dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID)
INNER JOIN dbo.AGENCY ON (dbo.AGENCY.AGENCYID=dbo.FOODINSTRUMENTSET.AGENCYID)
INNER JOIN dbo.CERTCONTACT ON (dbo.CERTCONTACT.STATEWICID=dbo.MEMBER.STATEWICID)
WHERE
(
dbo.FOODINSTRUMENTSET.MAILED = 'Y'
AND
dbo.FOODINSTRUMENTSET.AGENCYID = @prompt('Enter 3-digit Agency ID:','A','Dbo
Foodinstrumentset\Agencyid',Mono,Free,Persistent,,User:0)
AND
dbo.FOODINSTRUMENTSET.STATEWICID IN @dpvalue('A', DP4.DO1e7)
AND
CONVERT(date, dbo.FOODINSTRUMENTSET.CREATEDTTM, 101) BETWEEN @prompt('Enter Start Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:1) AND @prompt('Enter End Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:2)
AND
( dbo.CERTCONTACT.CERTSTARTDATE = dbo.MEMBER.CERTSTARTDATE
AND dbo.CERTCONTACT.CERTSTARTDATE = dbo.CERTCONTACT.CERTEFFECTIVEDATE
)
AND
(
Convert(datetime,dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE+'01',112)=Dateadd(month,1,convert(datetime,Mailed_Qry.Par
ticipationdate+'01',112))
OR
Convert(datetime,dbo.FOODINSTRUMENTSET.PARTICIPATIONDATE+'01',112)=Dateadd(month,1,convert(datetime,Mailed_Qry.Participationdate+'01',112)))
)
More than One Set Query
SELECT
dbo.FOODINSTRUMENTSET.STATEWICID,
COUNT(DISTINCT dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID),
dbo.AGENCY.NAME,
dbo.FOODINSTRUMENTSET.AGENCYID,
dbo.MEMBER.HOUSEHOLDID
FROM
dbo.FOODINSTRUMENTSET INNER JOIN dbo.MEMBER ON
(dbo.FOODINSTRUMENTSET.STATEWICID=dbo.MEMBER.STATEWICID)
INNER JOIN dbo.AGENCY ON (dbo.AGENCY.AGENCYID=dbo.FOODINSTRUMENSET.AGENCYID)
WHERE
(
dbo.FOODINSTRUMENTSET.MAILED = 'Y'
AND
8|Page
Mailed Two or More Consecutive Sets of Benefits
•••
dbo.FOODINSTRUMENTSET.AGENCYID = @prompt('Enter 3-digit Agency ID:','A','Dbo
Foodinstrumentset\Agencyid',Mono,Free,Persistent,,User:0)
AND
dbo.FOODINSTRUMENTSET.CREATEDTTM BETWEEN @prompt('Enter Start Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:1) AND @prompt('Enter End Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:2)
)
GROUP BY
dbo.FOODINSTRUMENTSET.STATEWICID,
dbo.AGENCY.NAME,
dbo.FOODINSTRUMENTSET.AGENCYID,
dbo.MEMBER.HOUSEHOLDID
HAVING COUNT(DISTINCT dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID) >= '2'
Consecutive Sets Query
SELECT
dbo.FOODINSTRUMENTSET.STATEWICID,
COUNT(DISTINCT dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID),
dbo.AGENCY.NAME,
dbo.FOODINSTRUMENTSET.AGENCYID,
dbo.MEMBER.HOUSEHOLDID
FROM
dbo.FOODINSTRUMENTSET INNER JOIN dbo.MEMBER ON
(dbo.FOODINSTRUMENTSET.STATEWICID=dbo.MEMBER.STATEWICID)
INNER JOIN dbo.AGENCY ON (dbo.AGENCY.AGENCYID=dbo.FOODINSTRUMENTSET.AGENCYID)
WHERE
(
dbo.FOODINSTRUMENTSET.MAILED = 'Y'
AND
dbo.FOODINSTRUMENTSET.AGENCYID = @prompt('Enter 3-digit Agency ID:','A','Dbo
Foodinstrumentset\Agencyid',Mono,Free,Persistent,,User:0)
AND
dbo.FOODINSTRUMENTSET.CREATEDTTM BETWEEN @prompt('Enter Start Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:1) AND @prompt('Enter End Date:','D','Dbo
Foodinstrumentset\Createdttm',Mono,Free,Persistent,,User:2)
AND
dbo.FOODINSTRUMENTSET.FOODINSTRUMENTSETID IN @dpvalue('N', DP3.DO1e6)
)
GROUP BY
dbo.FOODINSTRUMENTSET.STATEWICID,
dbo.AGENCY.NAME,
dbo.FOODINSTRUMENTSET.AGENCYID,
dbo.MEMBER.HOUSEHOLDID
9|Page