FAQ - Advanced Logic aid

advertisement
Page 1 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
This document describes the use of SQL operators and also the use of wild card “%”.
 SQL operators
Here's a quick reference of SQL operators you may need to use in the “advanced logic”
in IUIE:
Page 2 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
The above operators can be used to extract exact data with additional selection criteria from the
data group being used in a particular IUIE report object.
These operators join a column available in a data group to criteria in the advanced logic...
Examples:
INST_CD = 'IUINA'
Where the institution is IUPUI
ACAD_TERM_CD <> '4048'
Where the academic term is not First Semester 2004-2005
CLS_ASSCT_MAX_UNT_NBR >= 3
Where the maximum credit hours are greater than or equal to three
If the data base field is defined as a VARCHAR or DATE field, you must use single quotes for
the value in your criteria (as in example 1 and 2). However, if a data field is defined as a numeric
field, then you must not use single quotes around the value.
You can determine if a data field is a VARCHAR, DATE or Numeric by clicking on the column
name in the data group in the IUIE report object you will be using. Following is an example of
how to find technical name and field type for all the fields available in a report object. The
example used is the “Student Term” report object (Student/Records/Student Term/Data
Extracts).
Page 3 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
By clicking on the report object Title “Basic: Student Term” you will get the screen that
displays all the fields for selection as well as for use in the “advanced” logic. If you need to look
up a single field, click on the field and you will get information available for that field.
Page 4 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
Logical operators work like conjunctions in grammar. You use them to tie together related
clauses in an argument. If you have multiple criteria that all must be true for a database row to be
returned, separate your WHERE clause arguments with AND. If any one of your criteria can be
true, separate your arguments with OR. If you have more than one criterion, you must use logical
operators to connect them. When using “And” and “or” in a where clause, use caution. It is
always recommended that you use brackets where needed.
Following screens depict the use of advanced logic:
Page 5 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
Page 6 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
The above example shows the “advanced logic” used using SR_ENRL_BYSTK_GT
(Enrollment by Program Stack) in additional to parameters already available (INST, TERM,
Derived Enrollment Status = E) to get a list of students with grade points in the chosen range or a
course grade of either ‘F’ or ‘I’ or ‘R’ or ‘NR’.
(ACAD_PRM_PLAN_1_CD = 'NURSCPHD') AND ((STU_GRD_PTS_NBR > 0.0 AND STU_GRD_PTS_NBR <=2.0) OR
(CRS_OFCL_GRD_CD = 'F') OR (CRS_OFCL_GRD_CD = 'I') OR (CRS_OFCL_GRD_CD = 'R') OR (CRS_OFCL_GRD_CD = 'NR'))
ORDER BY PRSN_PREF_FULL_NM, ACAD_TERM_CD
The above clause in the advanced logic in addition to the selected parameters will produce the
following query:
select
CLS_NBR,
PRSN_UNIV_ID,
CRS_CRR_CD,
ACAD_CAREER_CD,
CRS_OFCL_GRD_CD,
STU_GRD_PTS_NBR,
ACAD_PRM_PLAN_1_CD,
PRSN_PRM_FULL_NM,
Page 7 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
ACAD_TERM_CD
from dss_rds.SR_ENRL_BYSTK_GT
WHERE (STU_DRV_ENRL_STAT_IND = 'E')
AND (INST_CD = 'IUINA')
AND (ACAD_TERM_CD = '4078')
Documentation
Author(s): Avery Nelson
Medha Sukhatme
(parameters)
AND (ACAD_PRM_PLAN_1_CD = 'NURSCPHD') AND ((STU_GRD_PTS_NBR > 0.0 AND
STU_GRD_PTS_NBR <=2.0) OR (CRS_OFCL_GRD_CD = 'F') OR (CRS_OFCL_GRD_CD = 'I')
OR (CRS_OFCL_GRD_CD = 'R') OR (CRS_OFCL_GRD_CD = 'NR')) ORDER BY
PRSN_PREF_FULL_NM, ACAD_TERM_CD
(ADVANCED LOGIC)
and will select students in the plan NURSCPHD with (grade points > 0 and < 2.0) or students with a grade of
F or I or R or NR grade.
 Wild Card
One can use a wildcard in conjunction with the LIKE condition to perform pattern matching.
Wild card is designated by a % sign. For example In using the “Enrollment by Class Org” object
under Students/Records (Commonly Used) in IUIE, subject = ENG% would select all the course
enrollment records for all currently active students where the subject begins with the letters
Page 8 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
Documentation
Author(s): Avery Nelson
Medha Sukhatme
ENG. This datagroup contains
The above example would result in the following query.
select
CLS_NBR,
PRSN_UNIV_ID,
ACAD_CAREER_CD,
CRS_CRR_CD,
INST_CD,
ACAD_TERM_CD,
ACAD_UNT_TKN_NBR
from dss_rds.SR_ENRL_BYORG_GT
WHERE (ACAD_CAREER_CD = 'UGRD')
AND (STU_DRVD_CLS_ENRL_STAT_IND = 'E')
AND (CRS_SUBJ_CD LIKE 'ENG%')
AND (INST_CD = 'IUINA')
(wild card)
Some more examples using wild card that can be used in the “Additional Criteria”:
ACAD_TERM_CD LIKE '408%'
Page 9 of 9
Last Updated:
Academic Unit Reporting Initiative
FAQ Advanced Logic
(to select any term beginning with 408 – 4082, 4085 or 4088)
ACAD_DRVD_EXPND_LVL_NM LIKE '%Fresh%'
(to select any Freshmen – associate or baccalaureate)
Documentation
Author(s): Avery Nelson
Medha Sukhatme
Download