You are on page 1of 31

Fusion HCM OTBI Best Practice Webinars

Introducing OTBI Logical SQL


Ling Xiang – Director, HCM Analytics Product Management, Oracle
Raghavendra Raghunath – Product Manager, HCM OTBI, Oracle
Imran Ali – Senior Director, OTBI Development, Oracle
Colin Foyle, Succeed Consultancy Ltd
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
Fusion OTBI Best Practice Webinars
• Monthly customer & partner training webinars
• Open to all Oracle cloud customers & partners
• Delivered by Oracle product development
• Address commonly asked Fusion reporting questions about OTBI & BIP
• Post questions to Customer Connect BI Forum
Agenda

• Introduction to Logical SQL

• When to Use Logical SQL

• How to write Logical SQL

• Developer Experience with Logical SQL

• Q&A
Why Logical SQL?
• Logical SQL is SQL developer tool
• Supports more complex logic that can be not accommodated in Answers
• It allows customers to write ANSI-like SQL while leveraging OTBI subject
areas
– Use the same OTBI business semantic model
– Use the same OTBI user data security
– Use OTBI flexfields
• Minimize custom SQL BIP reports
Introducing Logical SQL
Raghavendra Raghunath
Product Manager, HCM OTBI, Oracle
Introduction to Logical SQL(LSQL)

Use Case – Ronnie’s HR Report

Ronnie has an assignment to create a historical salary and performance rating


analysis of an employee for the upcoming promotion cycle in the
Organization.
Introduction to Logical SQL(LSQL)
• Ronnie pulls up the ‘Salary History Details’ and
‘Performance Rating’ subject areas to create the report

• She adds the relevant columns and filter conditions in


the criteria tab
Introduction to Logical SQL(LSQL)
• However, when she sees the results, it
shows up only 3 records

• Ronnie is sure that the employee has had


salary changes even in the earlier years
Introduction to Logical SQL(LSQL)
• She creates individual analyses based on
Salary history and Performance Rating
subject areas

• After seeing the results, it occurs to her


that OTBI does an equal join on “Person
Number” and ‘Year’ in the cross subject
area report, and hence displayed only
three records in this example*

*A cross subject area join performs an equal


join on the common dimensions shared by
the selected subject areas in an analysis
Introduction to Logical SQL(LSQL)
• Ronnie decides to build the same report using the Logical SQL to overcome the
limitations of pruned records from the report output

• The report built using the logical sql generates the report showing the entire salary
history along with the associated performance rating during each salary review
Where to View or Edit LSQL
• ‘Advanced Tab -> SQL Issued’ pane gives you
New Subject Areas
the Logical SQL issued by Oracle BI
Presentation services.
• With Admin privileges you can also view
Logical SQL in ‘Manage Sessions’ page in the
Administration tab
How to write LSQL?
• Let us look at how Ronnie constructed the lsql that solved her reporting
requirement
New Subject Areas

Use Case – Create a report to show all the salary changes for a worker and
the corresponding performance rating during those years
Solution – This reporting requirement involves two subject areas
– Compensation – Salary History Details Real Time : This subject area gets all the
salary changes for the worker
– Workforce Performance – Performance Rating Real Time: This subject area gets
the performance document period name and the corresponding ratings
How to write LSQL?

New Subject Areas


• The starting point to construct a logical sql is
by leveraging the sql generated in the
Advanced tab of the Analyses
• Report1 – create a report using ‘Salary
History Details Real Time’. Choose the
required columns.
• Navigate to the Advanced tab, copy the lsql
generated in the SQL issued pane
How to write LSQL?

New Subject Areas

• Report2 – create a report using ‘Performance


Rating Real Time’. Choose the required
columns.
• Navigate to the Advanced tab, copy the lsql
generated in the SQL issued pane
How to write LSQL?
• The queries from two different reports can be joined together using the relevant join conditions.
New Subject Areas

C:\Users\
rwraghun.ORADEV\Desktop\Salary H
How to write LSQL?
• The constructed logical sql must be pasted into the SQL Issued pane for a new analysis.
• TheNew Subject Areas
report output for the individual queries and newly created logical sql is as below
LSQL – multiple datasets

New Subject Areas


LSQL – multiple datasets
• Lsql can be used to join queries from multiple subject areas
New Subject Areas
• When joining two or more datasets, each dataset must be fetched through separate ‘Select ‘
statements
• In our example, there are two queries to fetch ‘Salary History’ and ‘Performance Rating’ for an
employee
• These two queries are joined together to output a single record for the corresponding year of
salary change and performance rating change.
• The join condition in the lsql authorizes an outer join between the two queries
• The columns used in the join is at the discretion of the users building the reports unlike in the
Answers tool where the join cannot be specified explicitly in a cross subject area report
Filters in LSQL
• The filters in LSQL can be independent of the columns in the ‘Select’ statement.
New Subject Areas
Aliases in LSQL
• The column alias in lsql is the prerogative of the users
• ByNew
default the lsql
Subject generated by BI Answers will have alias like s_0, s_1, s_2 and so on
Areas
• Users can provide meaningful names as column aliases
LSQL – Sorting
• The result set in the report created using lsql can be sorted using the ‘Order by’ clause at the end of
theNew
query
Subject Areas
Query and the report output
Logical SQL – Security

New Subject Areas


• Logical SQL inherits the same user security as an
analysis in Answers
• No need to code user security in Logical SQL.
When to Use LSQL?
• Most of the customer requirements are met using the OTBI drag and drop analyses
New Subject Areas
• In some of the cases that require the following conditions to create the report, it is advisable to
create the analyses using LSQL
1. Outer Join – As illustrated with Ronnie’s use case
2. Self Join – example: Get the Position names of both Worker and Manager in a report
3. Current and Prior rows – example: Get the current and previous jobs of employees
after promotion
4. Effective Date – example: control effective date logic in cross subject area joins
LSQL – Self Join
• Lsql are the only way when it requires a self join to the same dimension in a subject area
New Subject Areas
Use Case – Report on the Worker and Manager Positions
Limitation using drag and drop – The ‘Position Name’ is stored in the Position dimension. It takes the
‘manager person number’ to join with the same subject area as ‘person number’ to get the position
name.

D:\OTBI\
Customers\ANZ\Manager Position LS
LSQL – Current and Prior Rows
• Another classic case to use the lsql is to get the current and previous jobs of workers
New Subject Areas
Use Case – Print the Worker Name, current job, previous job in the report
Limitation using drag and drop – The current and previous jobs cannot be displayed in the same row as
two different columns since the values come from the same attribute and no filter criteria can get the
respective values.
This example leverages the RCOUNT function to get the recent and the immediate previous record for
employees from the Worker Assignment Event subject area

D:\OTBI\
Customers\Customer Connect\curren
LSQL – Control Effective Date Logic
Use Case – Use effective date range join to join Performance Review docs with Salary History
Limitation
New using dragAreas
Subject and drop – Depending on the common dimensions selected, an equal join on the common
dimensions, e.g. Worker can either result in a cartesian join with all performance ratings returned per salary or
records get pruned

D:\User\Product
Strategy\OBI App Dev\Fusi
Considerations in Writing Logical SQL
• Use Answers where possible
• Reserve Logical SQL for complex logic
• Study and re-engineer the logical SQLs generated by the system
• Code for query performance
Developer Experience with Logical SQL
Colin Foyle - Succeed Consultancy Ltd
Questions?

You might also like