Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rules Writing 101 Does RORRULE make you break out in a cold sweat

Similar presentations


Presentation on theme: "Rules Writing 101 Does RORRULE make you break out in a cold sweat"— Presentation transcript:

1 Rules Writing 101 Does RORRULE make you break out in a cold sweat
Rules Writing 101 Does RORRULE make you break out in a cold sweat? Does SQL give you hives? This session will teach some basics of writing rules in SQL. No prior SQL knowledge is assumed. Lin Taylor

2 CPE Credits To receive CPE credits for this session (if eligible), complete the CPE Attendance Form on the PABUG Annual Conference website For additional questions please contact Lora Harper CPE - Coordinator

3 Messiah College 2800 Undergraduate students 749 Graduate students Banner school since 2006

4

5 Basic SQL Data is stored in tables Often there is a form in Banner for the table that has a similar name ROASTAT RORSTAT RPAAWRD  RPRAWRD RBAPBUD  RBRAPBC

6 Basic SQL Every table contains fields also called columns,
which are pieces of data, and the name starts with the table name: RORSTAT RORSTAT_PIDM RORSTAT_AIDY_CODE RORSTAT_TGRP_CODE

7 Basic SQL The definition of the table has all its fields

8 How to find a field in Banner
Click on the field

9 How to find a field in Banner
Click on TOOLS To get the tools menu to pop up Then click Item Properties

10 How to find a field in Banner
Scroll down to find the physical name. The is the name of the field/column. Either copy it or type it into your rule.

11 Basic SQL Rules are SQL Queries. Queries have: SELECT FROM WHERE

12 Basic SQL Select  what fields (bits of data) you want
SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE, RPRAWRD_OFFER_AMT Note the commas

13 Basic SQL FROM  what table(s) FROM RPRAWRD

14 WHERE Filters the results WHERE RPRAWRD_AIDY_CODE = '1819'
Basic SQL WHERE Filters the results WHERE RPRAWRD_AIDY_CODE = '1819' Note: Single quotes, not double

15 Basic SQL SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE, RPRAWRD_OFFER_AMT FROM RPRAWRD WHERE RPRAWRD_AIDY_CODE = '1819' Results?

16 Basic SQL SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE, RPRAWRD_OFFER_AMT FROM RPRAWRD Does it work without the WHERE?

17 Basic SQL What if you need info from more than 1 table? Join

18 Basic SQL SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE,
RPRAWRD_OFFER_AMT FROM RPRAWRD WHERE RPRAWRD_AIDY_CODE = '1819‘ What if we want to know the packaging group And only get people who filed the FAFSA?

19 Basic SQL We need RORSTAT_PGRP_CODE And RORSTAT_APPL_RCVD_DATE FROM RORSTAT

20 Basic SQL Add the new field to the SELECT SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE, RPRAWRD_OFFER_AMT, RORSTAT_PGRP_CODE

21 Basic SQL Add the new table to the FROM FROM RPRAWRD, RORSTAT

22 Basic SQL Add the new filter to the WHERE using AND WHERE RPRAWRD_AIDY_CODE = '1819‘ AND RORSTAT_APPL_RCVD_DATE IS NOT NULL NULL means there is nothing in it

23 Basic SQL SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE,
RPRAWRD_OFFER_AMT, RORSTAT_PGRP_CODE FROM RPRAWRD, RORSTAT WHERE RPRAWRD_AIDY_CODE = '1819‘ AND RORSTAT_APPL_RCVD_DATE IS NOT NULL Will that work? No – will return all RPRAWRD for that year matched with all the rorstat records

24 Basic SQL When you join two tables you have to connect then together
using fields. When you look at a student’s award, you only want info: For that student For that aid year

25 Basic SQL For that student  PIDM For that aid year  AIDY_CODE
Note: In GRLSLCT, Banner matches the PIDMS for you.

26 Basic SQL SELECT RPRAWRD_AIDY_CODE, RPRAWRD_PIDM, RPRAWRD_FUND_CODE,
RPRAWRD_OFFER_AMT, RORSTAT_PGRP_CODE FROM RPRAWRD, RORSTAT WHERE RPRAWRD_AIDY_CODE = '1819' AND RORSTAT_APPL_RCVD_DATE IS NOT NULL AND RPRAWRD_AIDY_CODE = RORSTAT_AIDY_CODE AND RPRAWRD_PIDM = RORSTAT_PIDM

27 Basic SQL Joins can be complex: When looking at ISIR info
WHERE RCRAPP1_CURR_REC_IND = 'Y‘ Match on the current record AND RCRAPP1_PIDM = RCRAPP2_PIDM -- PIDM AND RCRAPP1_PIDM = RCRAPP3_PIDM AND RCRAPP1_PIDM = RCRAPP4_PIDM AND RCRAPP1_AIDY_CODE = '1819‘ -- Aid Year AND RCRAPP2_AIDY_CODE = '1819' AND RCRAPP3_AIDY_CODE = '1819' AND RCRAPP4_AIDY_CODE = '1819' AND RCRAPP1_INFC_CODE = RCRAPP2_INFC_CODE -- Type ISIR vs EDE AND RCRAPP1_INFC_CODE = RCRAPP3_INFC_CODE AND RCRAPP1_INFC_CODE = RCRAPP4_INFC_CODE AND RCRAPP1_SEQ_NO = RCRAPP2_SEQ_NO -- Sequence number AND RCRAPP1_SEQ_NO = RCRAPP3_SEQ_NO AND RCRAPP1_SEQ_NO = RCRAPP4_SEQ_NO

28 Different types of rules
RORRULE – Many types – select pidms PKGALGR – Packaging Rules Amounts RBRABRC – Budgeting Rules Amounts RORWVAR – Web Variables Rule

29 How to build a rule RORRULE

30 How to build a rule RORRULE No name validation
The rules are based on an already defined name T  Tracking groups A  Fund Codes B  Budget Groups etc

31 How to build a rule If you find a tracking group with no rule defined,
you will see this screen:

32 How to build a rule Starting from scratch
Page down to the 2nd block and click on the … to select a table name.

33 How to build a rule Type in the table name and click on the table

34 How to build a rule Click on Column Name

35 How to build a rule Type in all or part of the name
And Click on the field

36 How to build a rule Click the operator to select
what you are looking for, then save it. (Click Save)

37 How to build a rule I added RCRAPP2_MODEL_CDE = ‘D’ (Dependent)

38 How to build a rule You can add all your fields this way or…
Click tools and select Compiled/Expert SQL Code

39 How to build a rule Compiled/Expert SQL Code allows for free form editing

40 How to build a rule Very cool! Because you can make
more complex rules than with GLRSLCT

41 How to build a rule You can add returns to make it more readable

42 How to build a rule SELECT DISTINCT(RORSTAT_PIDM) FROM RORSTAT WHERE RORSTAT_APPL_RCVD_DATE IS NOT NULL AND RORSTAT_PIDM = :PIDM AND RORSTAT_AIDY_CODE = :AIDY You will notice that it added aid year and pidm for me. :AIDY matches records to the current aid year. :PIDM is the current pidm being evaluated.

43 How to build a rule Let’s add verification status = ‘V’

44 We start the line with AND because we want all the things to be true.
How to build a rule SELECT DISTINCT(RORSTAT_PIDM) FROM RORSTAT WHERE RORSTAT_APPL_RCVD_DATE IS NOT NULL AND RORSTAT_PIDM = :PIDM AND RORSTAT_AIDY_CODE = :AIDY AND RORSTAT_VER_PAY_IND = 'V' We start the line with AND because we want all the things to be true.

45 How to build a rule AND RORSTAT_VER_PAY_IND IN ('S','V')
If you are looking for more than 1 code, use IN SELECT DISTINCT(RORSTAT_PIDM) FROM RORSTAT WHERE RORSTAT_APPL_RCVD_DATE IS NOT NULL AND RORSTAT_PIDM = :PIDM AND RORSTAT_AIDY_CODE = :AIDY AND RORSTAT_VER_PAY_IND IN ('S','V') RORSTAT_TGRP_CODE IN ('XWTHDN','XCNCLD','XNAPST')

46 RORSTAT_VER_PAY_IND NOT IN ('S','V')
How to build a rule Using NOT RORSTAT_VER_PAY_IND NOT IN ('S','V') RORSTAT_TGRP_CODE NOT IN ('XWTHDN','XCNCLD','XNAPST') When you want all the codes except for those codes.

47 RORSTAT_TGRP_code LIKE 'U%'
How to build a rule LIKE can come in handy. All of our Undergrad Tracking groups start with U RORSTAT_TGRP_code LIKE 'U%' Selects all the students with a tracking group that starts with 'U', which for us is all the students with UG tracking groups.

48 How to build a rule Matching on a date:
RORSTAT_APPL_RCVD_DATE <= TO_DATE('01-APR-2017') Date must be in this format '01-APR-2017' OR you can subtract from today’s date: SYDATE = today RORSTAT_APPL_RCVD_DATE <= SYDATE – 10 FAFSA received at least 10 days ago

49 How to build a rule SELECT DISTINCT(RPRAWRD_PIDM) FROM RPRAWRD WHERE RPRAWRD_AIDY_CODE = :AIDY Use DISTINCT if there is more than 1 record per student for that filter. RORRULE uses this

50 How to build a rule SELECT DISTINCT(ROBUSDF_PIDM)
FROM ROBUSDF, SPBPERS, RORSTAT WHERE (ROBUSDF_VALUE_3 IS NOT NULL OR (SPBPERS_ETHN_CODE IN ('1','1N') AND RORSTAT_INFC_CODE IS NULL )) AND SPBPERS_PIDM = ROBUSDF_PIDM AND RORSTAT_PIDM = ROBUSDF_PIDM AND RORSTAT_AIDY_CODE = ROBUSDF_AIDY_CODE AND ROBUSDF_AIDY_CODE = :AIDY AND ROBUSDF_PIDM = :PIDM OR!!

51 OR (SPBPERS_ETHN_CODE IN ('1','1N') AND RORSTAT_INFC_CODE IS NULL ))
How to build a rule Using OR WHERE (ROBUSDF_VALUE_3 IS NOT NULL OR (SPBPERS_ETHN_CODE IN ('1','1N') AND RORSTAT_INFC_CODE IS NULL ))

52 How to build a rule You are admitted: If you have a ticket
R rated movie You are admitted: If you have a ticket If you are 17 or older If you are with a parent Either or

53 WHERE You_have_a_ticket = 'Yes' Age >=17 With_a_ parent = 'Yes'
How to build a rule R rated movie WHERE You_have_a_ticket = 'Yes' Age >=17 With_a_ parent = 'Yes'

54 WHERE You_have_a_ticket = 'Yes' AND Age >=17
How to build a rule R rated movie WHERE You_have_a_ticket = 'Yes' AND Age >=17 OR With_a_ parent = 'Yes'

55 WHERE You_have_a_ticket = 'Yes' AND
How to build a rule R rated movie WHERE You_have_a_ticket = 'Yes' AND (Age >=17 OR With_a_ parent = 'Yes') OR – usually require parenthesis

56 How to test a rule Yes, how? ?????

57 How to test a rule ROAIMMP Find a student who should be in the group
And run them through ROAIMMP ?????

58 How to test a rule You can test other rule types like
PKGALGR – Packaging Rules Amounts RBRABRC – Budgeting Rules Amounts RORWVAR – Web Variables Rule ?????

59 How to test a rule Type in the ID and AID Year Then confirm the
????? Type in the ID and AID Year Then confirm the and click Execute calculated Value

60 Other Rules

61 RBRABRC Algorithmic budgeting
SELECT baninst1.mc_fa_budget.get_art_fee(:AIDY, :PBTP) FROM rzvpbgp WHERE rzvpbgp_pidm = :PIDM AND rzvpbgp_aidy_code = :AIDY AND rzvpbgp_period = :PERIOD AND rzvpbgp_majr_code LIKE '%ART%' Why no hard coded amount?

62 PHEAA Rule - Packaging SELECT DISTINCT RORSTAT_PIDM FROM RCRAPP1, RORSTAT WHERE RCRAPP1_AIDY_CODE = RORSTAT_AIDY_CODE AND RCRAPP1_PIDM = RORSTAT_PIDM AND RCRAPP1_CURR_REC_IND = 'Y' AND RORSTAT_APPL_RCVD_DATE IS NOT NULL AND RCRAPP1_RCPT_DATE < TO_DATE('01-MAY-2017') AND RCRAPP1_STAT_CODE_RES = 'PA' AND RORSTAT_AIDY_CODE = :AIDY AND RORSTAT_PIDM = :PIDM

63 Another rule SELECT RORSTAT_PIDM FROM RORSTAT, SHRLGPA WHERE RORSTAT_PIDM = SHRLGPA_PIDM AND RORSTAT_AIDY_CODE = :AIDY AND RORSTAT_PIDM = :PIDM AND SHRLGPA_LEVL_CODE = 'UG' AND SHRLGPA_GPA_TYPE_IND = 'O' AND ROUND(SHRLGPA_GPA, 2) >= 3.0

64 Continuing students packaging group rule
SELECT DISTINCT(RZVTGRP_PIDM) FROM RZVTGRP WHERE RZVTGRP_AIDY_CODE = :AIDY AND RZVTGRP_PIDM = :PIDM AND ((RZVTGRP_MODULE = 'STU' AND RZVTGRP_STYP_CODE IN ('C','E','R','X', 'T', 'N','M','O','B')) OR (RZVTGRP_MODULE = 'ADM' AND RZVTGRP_STYP_CODE = 'R'))

65 Open to the Floor Questions Comments

66 Thank You Your input matters! Please submit a session evaluation. PABUG Mobile App Session Browser


Download ppt "Rules Writing 101 Does RORRULE make you break out in a cold sweat"

Similar presentations


Ads by Google