FORCES 2013 - Largo, Florida Writing Formulas for the OBIEE Answers Super-User in You! How a little SQL, Excel and Notepad makes it easy(er) Patrick McCormack, SPHR, Senior Human Resources Advisor Organization Development (904) 665-7059 PATRICK MCCORMACK, SPHR SENIOR HUMAN RESOURCES ADVISOR JEA, \JACKSONVILLE, FLORIDA • Reconfigured employee database for US Navy PATRON 30 • Developed 1st Veterans Services Tracking database for University of North Florida • Developed 1st Equal Employment Opportunity Tracking database for Mayor’s Office, City of Jacksonville • Developed Self-Audit Timecard tracking spreadsheet for Personnel Office, City of Jacksonville • Developed tracking database for DOT drug and alcohol testing, City of Jacksonville • HR Report Writer using D&B database, JEA • HR Implementation Team Oracle, JEA • HR Report Writer using Discoverer, JEA • HR Implementation Team Oracle (R12), JEA • HR Implementation Team OBIEE, JEA • HR Report Writer using Business Objects, JEA • HR Report Writer using OBIEE, JEA 2 Today • Explore ways to create formulas – Look at helpful SQLs and simple Fxs – MS Excel as a formula worksheet builder – Notepad as a tool and storage • EXTRA – ease the burden of tracking – Answer Reports – Answer Formulas 3 4 5 Tools Used • Notepad • Microsoft Excel • Microsoft Access 6 Materials • SQL All-In-One for Dummies (Allen G. Taylor) • Dashboard & Report Design & Best Practices (Amy Mayer & Kevin McGinley) • Oracle Business Intelligence Answers, Delivers, and Interactive Dashboards Users Guide V. 10.1.3.2 • Various internet available resources • OBIEE SQL-92 help files • And the . . . 7 Version 10g or 11g? 8 New or Regular User? 9 You might ask What’s to learn in the first place? © P.McCormack2012 10 11 12 13 14 <saw:report xmlns:saw="com.siebel.analytics.web/report/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlVersion="200705140" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sawx="com.siebel.analytics.web/expression/v1"> <saw:criteria subjectArea="&quot;Human Resources Compensation&quot;"> <saw:columns> <saw:column formula="&quot;Employee Attributes&quot;.&quot;Employee Number&quot;" columnID="c0"/> <saw:column formula="&quot;Employee Attributes&quot;.&quot;Employee Name&quot;" columnID="c1"/> <saw:column formula="&quot;Salary Facts&quot;.&quot;Actual Hourly Rate&quot; * 2080" columnID="c2"/></saw:columns></saw:criteria></saw:report> 15 But when - 16 And what happens when the requested information is not in the system in the form the requester wants? Let’s check 17 18 Helpful SQL • CAST (text AS INTEGER) cast("Employee Attributes"."Employee Number" as int) 19 Helpful SQL • CASE WHEN THEN ELSE END [LENGTH/SUBSTRING] CASE when SUBSTRING(Job."Job Description" FROM LENGTH(Job."Job Description")-8 FOR 4) = '0070' THEN 'JEA AFSCME' when SUBSTRING(Job."Job Description" FROM length(Job."Job Description")-8 FOR 4) = '0090' then 'JEA LIUNA' when SUBSTRING(Job."Job Description" FROM length(Job."Job Description")-8 FOR 4) = '0179' then 'AFSCME TEMPORARY' when SUBSTRING(Job."Job Description" FROM length(Job."Job Description")-8 FOR 4) = '0190' then 'LIUNA TEMPORARY' when SUBSTRING(Job."Job Description" FROM length(Job."Job Description")-8 FOR 4) = '1618' then 'SJRPP IBEW' when SUBSTRING(Job."Job Description" FROM length(Job."Job Description")-8 FOR 4) = '2668' then 'EXTERNAL CONTRACTOR' ELSE 'UNKNOWN' END 20 Helpful SQL • CONCAT CONCAT("Employee Personal Attributes"."Employee Permanent Adderss Line 1","Employee Personal Attributes"."Employee Permanent Adderss Line 2") "Employee Personal Attributes"."Employee Permanent Adderss Line 1"||"Employee Personal Attributes"."Employee Permanent Adderss Line 2"||"Employee Personal Attributes"."Employee Permanent Adderss Line 3“ 21 Helpful SQL • • • • LEFT, RIGHT LENGTH (demonstrated) LOCATE (demonstrated next slide) SUBSTRING (demonstrated) 22 LOCATE • Locate CONCAT('00',SUBSTRING("Employee Organization"."Employee Organization Name" FROM LOCATE('4',"Employee Organization"."Employee Organization Name") FOR 3)) 23 Helpful SQL • TimestampAdd TimestampAdd(SQL_TSI_YEAR, 26, "Employee Personal Attributes"."Employee Birth Date") SQL_TSI_SECOND SQL_TSI_MINUTE SQL_TSI_HOUR SQL_TSI_DAY SQL_TSI_WEEK SQL_TSI_MONTH SQL_TSI_QUARTER SQL-TSI_YEAR 24 Helpful SQL • TimestampDiff TimestampDiff(SQL_TSI_DAY, "Employee Personal Attributes"."Employee Birth Date",TIME.DATE)/365.2422 TimestampDiff(SQL_TSI_DAY, "Employee Personal Attributes"."Employee Birth Date",Current_date)/365.2422 25 Multi-Program Formula Creation 26 27 28 29 30 Cut to Excel 31 32 33 34 35 36 37 38 Writing a formula in Excel 39 Writing a formula in Excel 40 Writing a formula in Excel 41 Writing a formula in Excel =Concatenate(a1,b1,c1) 42 Writing a formula in Excel 43 Writing a formula in Excel 44 Writing a formula in Excel 45 46 • Cut and Paste • Complete Formula Case Else ‘Other’ End 47 CASE when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' when "Payment Type"."Payment Tax)Participant + Child(ren)' when "Payment Type"."Payment Tax)Participant + Family' when "Payment Type"."Payment Tax)Participant + Spouse' when "Payment Type"."Payment Tax)Participant Only' END Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 126.66 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 276.71 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 154.70 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical ER' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 271.84 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 97.98 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 214.05 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 119.67 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical ER' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 210.02 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 141.10 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 308.26 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 172.35 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical ER' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 302.84 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 389.24 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 689.34 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 445.32 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 135.92 THEN 'Medical Medical Default Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 300.97 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 533.11 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 344.35 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 105.01 THEN 'Medical Medical HDHP Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 433.62 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 767.94 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 496.12 THEN 'Medical Medical High Option Plan (Pre Type Description" = 'Medical PT' and "COMPENSATION FACTS"."PAY ITEM AMOUNT" = 151.42 THEN 'Medical Medical High Option Plan (Pre 48 Ifnull(“Employment Attributes”.”Employee You Can Always Write a Formula Last Hire Date”,”Employment Attributes”.”Employee Directly into Notepad Adjusted Service Date”) 49 50 MAIN ENTRY 51 52 Library Database Brief Listing 53 Library Listing By Consumer 54 Library of Formula 55 Library of Formula 56 Items Covered • • • • • Why have easier ways to write formula How a little SQL helps How Notepad can help How Excel can help How Access can help 57 Do You Have Any Questions? © 2012.P.McCormack 58