Example Clauses Queries

advertisement
Example clauses & queries using ART/BO XI
“If” clause examples using logical operators:
=If((IsNull([Household Uid])) Or ([Household Type]="Single
Adult");"Single";"Family")
=If(([Entry Objects].[Presently Attending School?(147)]="No")And([Exit
Objects].[Presently Attending School?(147)]="Yes");"Improved";"Not Improved")
=If(([Entry Objects].[Unemployed?(531)]="Yes")And([Exit
Objects].[Unemployed?(531)]="No");"Improved";"No Change/Worse")
Nested “If” sorting clients by age (3 examples):
=If([Age (Calculated)]Between(0;4.99);"Newborn to 4";If([Age
(Calculated)]Between(5;10.99);"5 to 10";If([Age (Calculated)]Between(11;14.99);"11 to
14";If([Age (Calculated)]Between(15;17.99);"15 to 17";If([Age
(Calculated)]Between(18;24.99);"18 to 24";If([Age (Calculated)]Between(25;34.99);"25
to 34";If([Age (Calculated)]Between(35;44.99);"35 to 44";If([Age
(Calculated)]Between(45;54.99);"45 to 54";If([Age (Calculated)]Between(55;64.99);"55
to 64";"65 and up")))))))))
=If([Age (Calculated)af]<5;"1. Age 0 to 4";If([Age (Calculated)af]Between(5;10.99);"2.
Age 5 to 10";If([Age (Calculated)af]Between(11;14.99);"3. Age 11 to 14";If([Age
(Calculated)af]Between(15;17.99);"4. Age 15 to 17";If([Age (Calculated)af]
Between(18;24.99);"5. Age 18 to 24";If([Age (Calculated)af]Between(25;34.99);"6. Age
25 to 34";If([Age (Calculated)af]Between(35;44.99);"7. Age 35 to 44";If([Age
(Calculated)af]Between(45;54.99);"8. Age 45 to 54";If([Age
(Calculated)af]Between(55;64.99);"9. Age 55 to 64";"Age 65 and older")))))))))
=If([Age (Calculated)af]<6;"a. Age 0 to 5";If([Age (Calculated)]Between(6;11);"b. Age
6 to 11";If([Age (Calculated)af]Between(12;17);"c. Age 12 to 17";If([Age
(Calculated)af]Between(18;23);"d. Age 18 to 23";If([Age
(Calculated)af]Between(24;44);"e. Age 24 to 44";If([Age
(Calculated)af]Between(45;54);"f. Age 45 to 54";If([Age
(Calculated)af]Between(55;64);"g. Age 55 to 64";"h. Age 65 and older")))))))
Nested “If” with Match Wildcard statement to filter out defined criteria:
=If(
Match(Upper([Entry Exit Provider Updating]); "*XXX*")
Or
Match(Upper([Entry Exit Provider Updating]); "*ZZ*")
; "Other" ; [Entry Exit Provider Updating])
If clause replacing a null value using a date value.
=ToDate(If(IsNull([Entry Exit Exit Date]);'6/30/2006';[Entry Exit Exit
Date]);”MM/dd/yyyy”)
Age:
=(DaysBetween([Date of Birth(893)];[Entry Date for AHAR]))/365
=RelativeDate(If(IsError(ToDate([End Date];"M/dd/yyyy"));ToDate([End
Date];"M/dd/yyyy H:mm:ss a");ToDate([End Date];"M/dd/yyyy"));-182)
Total with Alcohol and/or Drug Abuse
=Count(If(([Query 1].[Disability Type(432)]="Alcohol Abuse (HUD 40118)") Or([Query
1].[Disability Type(432)]="Drug Abuse (HUD 40118)");[Query 1].[Client Unique Id];0))
Calculated the Percent of Clients:
=[Total with Alcohol and/or Drug Abuse]/([Total Clients] In Block)
=If(([Singles].[Is Client Homeless?(75)]="Yes")And([Age
(Calculated)s]Between(11;17.99))And(((IsNull([Singles].[Household
Uid]))Or([Singles].[Household Type]="Single Adult"));1;0)
Resetting Context to Calculated Percent over Unique Clients rather than number of
items in the sub assessment (the default percentage).
% of Clients:
=[Total Clients]/([Total Clients] In Block)
Positive Housing Placement:
=If([Entry Exit Destination]="Rental room/house/apartment"Or[Entry Exit
Destination]="Own house/apartment"Or[Entry Exit Destination]="Transitional housing
for homeless"Or [Entry Exit Destination]="Staying in a family members
room/apartment"Or[Entry Exit Destination]="Staying in a friend's
room/apartment/house" Or[Entry Exit Destination]="Foster care/Foster care group
home"Or[Entry Exit Destination]="Other: Other supportive housing"Or[Entry Exit
Destination]="Permanent: Other subsidized house/apartment"Or[Entry Exit
Destination]="Permanent: Shelter Plus Care"Or[Entry Exit Destination]="Permanent:
Section 8"Or[Entry Exit Destination]="Substance abuse treatment/detox center"Or[Entry
Exit Destination]="Psychiatric hospital/facility"Or[Entry Exit Destination]="Hospital
(non-psychiatric)"Or[Entry Exit Destination]="Other"Or[Entry Exit
Destination]="Permanent housing for formerly homeless (S+C, SHP, etc.)";1;0)
If([Singles].[Client Unique Id])Where(([Singles].[Is Client
Homeless?(75)]="Yes")And([Age
(Calculated)s]Between(11;17.99))And(((IsNull([Singles].[Household
Uid]))Or([Singles].[Household Type]="Single Adult";Count))))
Definition of a positive placement is based on inspection of data and agency consensus.
Within the actual benchmarking project, an additional qualifier has been added allowing
programs to discriminate between a doubled-up or hospitalization status that is positive
from one that is likely to add trauma or be very short term.
Example of “Where” Operator:
=Count([Singles].[Client Unique Id])Where(([Singles].[Is Client
Homeless?(75)]="Yes")And([Age (Calculated)s]>17.99))
=Count([Singles].[Client Unique Id])Where(([Singles].[Is Client
Homeless?(75)]="Yes")And([Age
(Calculated)s]Between(11;17.99))And(((IsNull([Singles].[Household
Uid]))Or([Singles].[Household Type]="Single Adult"))))
=Count([Adults in Family].[Client Unique Id])Where(([Adults in Family].[Is Client
Homeless?(75)]="Yes")And([Age (Calculated)af]>17.99)And(((Not(IsNull([Adults in
Family].[Household Uid])))And([Adults in Family].[Household Type]<>"Single
Adult"))))
Working with Sub Assessments:
Finding the first value by Start Date:
=Min([Income Rating] In ([Client Uid];[Start Date(2837)]))
Finding the last or most recent value by Start Date:
=Max([Income Rating] In ([Client Uid];[Start Date(2837)]))
Creating a Countmary field that calculates an Average Value:
=Average(Min([Income Rating] In ([Client Uid];[Start Date(2837)])) In([Client Uid]))
or if you have built a variable: =Average(([Income Rating Initial]) In([Client Uid]))
Provides a sum of all values in a sub-assessment:
=(Count(([Income Rating Initial]) In([Client Uid])))+ (Count(([Employment Rating
Initial]) In([Client Uid])))+ (Count(([Housing Rating Initial]) In([Client Uid])))+
(Count(([Credit Rating Initial]) In([Client Uid])))+ (Count(([Food Rating Initial])
In([Client Uid])))+ (Count(([Childcare Rating Initial]) In([Client Uid])))+
(Count(([Children’s Education Initial]) In([Client Uid])))+ (Count(([Adult Education
Initial]) In([Client Uid])))+ (Count(([Legal Rating Initial]) In([Client Uid])))+
(Count(([Health Care Initial]) In([Client Uid])))+ (Count(([Life Skills Initial]) In([Client
Uid])))+ (Count(([Mental Health Initial]) In([Client Uid])))+ (Count(([Income Rating
Initial]) In([Client Uid])))+ (Count(([Substance Abuse Initial]) In([Client Uid])))+
(Count(([Family Relations Initial]) In([Client Uid])))+ (Count(([Mobility Rating Initial])
In([Client Uid])))+ (Count(([Community Involvement Initial]) In([Client Uid])))+
(Count(([Safety Rating Initial]) In([Client Uid])))+ (Count(([Parenting Skills Initial])
In([Client Uid])))+ (Count(([Disability Rating Initial]) In([Client Uid]))))
Provides a count of all values in a sub-assessment:
=(Count(([Income Rating Initial]) In([Client Uid])))+ (Count(([Employment Rating
Initial]) In([Client Uid])))+ (Count(([Housing Rating Initial]) In([Client Uid])))+
(Count(([Credit Rating Initial]) In([Client Uid])))+ (Count(([Food Rating Initial])
In([Client Uid])))+ (Count(([Childcare Rating Initial]) In([Client Uid])))+
(Count(([Children's Education Initial ]) In([Client Uid])))+ (Count(([Adult Education
Initial]) In([Client Uid])))+ (Count(([Legal Rating Initial]) In([Client Uid])))+
(Count(([Health Care Initial]) In([Client Uid])))+ (Count(([Life Skills Initial]) In([Client
Uid])))+ (Count(([Mental Health Initial]) In([Client Uid])))+ (Count(([Income Rating
Initial]) In([Client Uid])))+ (Count(([Substance Abuse Initial]) In([Client Uid])))+
(Count(([Family Relations Initial]) In([Client Uid])))+ (Count(([Mobility Rating Initial])
In([Client Uid])))+ (Count(([Community Involvement Initial]) In([Client Uid])))+
(Count(([Safety Rating Initial]) In([Client Uid])))+ (Count(([Parenting Skills Initial])
In([Client Uid])))+ (Count(([Disabilities Rating Initial]) In([Client Uid])))
Query to pull Dual Disorders (Drug/Al and MH)
Pull for Singles
=If([Age (Calculated)af]Between(0;4.99);"1. Newborn to 4";If([Age
(Calculated)af]Between(5;10.99);"2. 5 to 10";If([Age
(Calculated)af]Between(11;14.99);"3. 11 to 14";If([Age
(Calculated)af]Between(15;17.99);"4. 15 to 17";If([Age
(Calculated)af]Between(18;24.99);"5. 18 to 24";If([Age
(Calculated)af]Between(25;34.99);"6. 25 to 34";If([Age
(Calculated)af]Between(35;44.99);"7. 35 to 44";If([Age
(Calculated)af]Between(45;54.99);"8. 45 to 54";If([Age
(Calculated)af]Between(55;64.99);"9. 55 to 64";"10. 65 and up")))))))))
Adults in Family Query:
Adults in Family Expanded final subquery
Singles Top Section of Query:
Singles – Final subquery
Download