How to show only highest education in OBIEE - plsql

Good evening everyone,
I am using OBIEE and I am trying to extract a file containing some candidates' information to keep in our records, as my organization will need to delete most data soon.
I have data related to recruiting that people put in their applications for job vacancies.
I am trying to have a single row per candidate per application (i.e. if a candidate applied to 2 different jobs, it will count as 2 rows), and insert the highest education, the related insitution, their most recent job title, and the most recent employer name.
I have these facts:
ID,
degree_type,
institution,
job title,
employer.
and they all have the starting date and the graduation date.
When I extract the report, I get something like this:
ID
degree_type
institution
job_title
employer
001
Doctorate
Univ. A
eater
google
001
Master's
Univ. B
sleeper
samsung
001
Other
Univ. A
jumper
apple
002
Bachelor's
Univ. C
clapper
nutella
002
Master's
Univ. D
somethinger
fujitsu
002
Doctorate
Univ. A
somethinger
fujitsu
003
Other
Univ. E
eater
EU
003
Doctorate
Univ. Z
spy
UN
As you can see, each person might or might not have different levels of education, and when I extract this analysis, I have one ID with multiple rows, as many as every degree and every job experience, sorted by chronological order.
This creates some readability issues. Besides, we only want the highest degree and the most recent job.
So something like this.
ID
degree_type
institution
job_title
employer
001
Doctorate
Univ. A
eater
google
002
Doctorate
Univ. A
somethinger
fujitsu
003
Doctorate
Univ. Z
eater
EU
Instead, when I try to apply filters or step, I can only manage to obtain a result based on either
A) the most recent degree and the most recent employer, or
B) each degree and each work experience that was carried out in the same time period of the degree.
Option A does not work for multiple reasons, e.g., if someone got a certification after a PhD, I will have a person with "other" whereas they should have "doctorate"
Option B is not useful at the moment, as we only want one row. Besides, if I worked after getting a degree, that work experience would not appear as it only shows the work carried out during the studies.
I am new with OBIEE, and I am not familiar with SQL. I usually use R, and for completely different reasons.
If I could assign a value to each degree and then filter by the highest (eg., IF there is a doctorate, THEN show it and STOP. ELSE show master's. IF not master's and doctorate, THEN show bachelor's and STOP.) And then add the work experience by date, that would be great.
Is there a way to do this?
Thank you so much! And apologies if it does not make any sense.
PS> I saw this reply already How To Get Highest Education Using MySQL?
but that person has multiple columns for each degree, whereas I have them altogether.

I am assuming that OBIEE is just a DB and you can use SQL to get the info.
I also assume that the ID column you provide represents unique ID per Employee.
Your task requires intermediate if not advanced SQL techniques to solve. Here are the steps.
you need to codify the sort order of the degree level - in 3NF (third normal form) you would add a reference table to store one row per degree and include degree_name varchar column (primary key) to equal the values you list in your post, but then another column degree_sort integer that sorts the degrees the way you want. You would join to this table on the varchar value and return the degree_sort value
Handling ties: Another complexity is how to handle the possibility of a employee having multiple jobs at the doctorate (I presume that is the highest) education level - you would need a "start_date" or some data point to break ties.
Here's a stack post that explains an analogous scenario, getting the record that represents the latest revision of a document (revision is your degree level, document is your employee ID):
https://stackoverflow.com/a/38854846/1279373
Your partition clause would be:
PARTITION BY id ORDER BY degree_sort DESC, start_date DESC
Note: The where clause (see sql in the referred to answer) handles "return only the rows with rank 1"; use ASC (ascending) and DESC (descending) in the ORDER BY clause to rank "low to high" or "high to low".

Related

Qualtrics: Assign 4-digit Unique Participant ID number after enrolling via QR code

This is for longitudinal human subjects biomedical research. The basic flow of the enrollment process is this:
Enter clinic & scan QR code OR click email link
Read informed consent form and check I consent [survey]
Pass study screener question (are you 18 yo) [survey]
Contact form - enter your name, phone, email [survey w/ workflow to create XM
directory from this data]
Baseline survey [survey w/ ID number attached]
I have it set up right now that survey 2,3,4 all flow together assuming you meet all the criteria. This study is longitudinal so for every survey I want their ID number attached so we can track changes over time at the person-level. We are also collecting blood samples so I will need their participant ID number on their blood tubes so we know who's who when we process and analyze them. Therefore the nurse will need to know their ID number between steps 4 & 5.
I've seen on the community boards that assigning a random number does not guarantee unique values and that unless you make the number long you might have a duplicate. Can't have that. The numbers must be unique and 4 digits so the clinic staff doesn't get bogged down writing a 10-digit number on a blood tube.
I'd love for this number to be sequential, but beggars can't be choosers.
Any ideas on how to do this?? Here are my thoughts thus far
In step 4 (the contact sheet) set a quota larger than the participants I plan to enroll and then save the quota count as embedded data. Then in the workflow where I create the contact directory, save the quota number into an ID number field. DRAWBACK: if multiple people are enrolling at once, Quatrics Customer Service said they can't guarantee that two people won't have the same quote number but couldn't give details about how to define "at the same time". like clicking it at the same milisecond? second? few seconds?
Use the Qualtrics generated unique Person ID field, which is very long and alphanumeric and somehow re-code it with.... python magic?
Thank you!!!

Whilst making ERD's in a recursive relationship does it always have to link N to N or can it be N to 0 or 1?

The title sums it up pretty much, needing help with it to continue with my ERD for my class. The instructions the teacher gave were:
It is intended to keep information about the albums (title, year, comment, compilation) being relevant to keep the respective nationality, musical genre, as well as the artists who participate in it.
• Artists can be a person or a group and are characterized by a name and type of artist. It is also important to know who the artists that make up the group are.
• The artists' participation in the album implies the indication if the participation is the main role or not, as well as the type of intervention (instrument) that each artist has in the album.
I currently have it linked like this
https://gyazo.com/1b1a8ef130906c875e888ec0eb46bf09
As per the instructions I have the main role part, but I thought it could be a relation instead of an entity and would link back to the artist N to 0 or 1...
Thanks for your time
to answer your question simply - NO it dont have to be N...N
the idea of recursive relationships is that you can 'bundle' entities of same structure that interacts with each other to simplify the ERD.
e.g. the Employee vs Supervisor example :)
IF it could only be N...N
N Employees would always be overseen by N Supervisors.
but in most cases N Employee is overseen by 1 Supervisors, which is also an employee, therefor you can write your recursive relation on the ERD as N..X

Tableau graph average and sum

I have transactional data for a sales team showing the transaction amount per transaction, the sales person for that transaction, his team and his salary. Every row denotes a unique transaction (please refer image). I need to make a team-level graph which shows the correlation between the salary they are paid and the revenue they generate for the company i.e. a simple stacked bar chart with salesTeam name on X axis and amounts on the y axis with every bar representing the total salary and total revenue(Amount) for a team.
In the example I've highlighted team 'Central', for which the salary paid is 25k (10k for salesperson A + 15k for salesperson B) and the revenue they make for the company is 430k. Please note that the salaries for some salespersons may be missing (eg. for E). The issue I'm facing is that sum(Salary) adds up the salaries for every row, so for salesperson A it becomes 20k instead of 10k. I tried avg(Salary) but that doesn't work as Tableau calculates the average for the entire column instead of average per salesperson. How can I solve this issue?
Thanks
Here you have a level of detail problem. Basically, Tableau will calculate a formula at the level of detail of the visualisation, so if salesperson is not in your view it will roll up the equation to calculate at the highest level. This is great when you want a dynamic calculation but that doesn't sound like what you are trying to achieve.
Your best option would be to aggregate the data into Tableau so you only have 1 line per sales person with a total of their revenue for all transactions. This would avoid the complexity of the calculated field (and make Tableau perform better).
However, if this is not possible the good news is the answer is a Level of Detail expression (i recommend doing some reading on this if you havent come across before). Basically, you tell Tableau at what level you want the calculation at.
If I understand you want to calculate the ratio of transaction amount and salary paid for each team.
So create a calculated field as follows:
{ FIXED [Team]
: sum(([Amount]))/
(sum({ FIXED [Sales person]:
AVG([Salary])}))
}
What this does is calculates for each team the ratio between the amount and the salary. The use of the second fixed equation that is nested within it (Salesperson) ensures that the salary is not summed for the number of transactions of a salesperson.
Using this I got a result of 17.2 for Central. Is this what you would expect? Do you need a way to account for salaries that are not known?

Users, Roles, and Security Groups Management - How to Set up a Downline in SuiteCRM

SuiteCRM 7.5.1 - In Reference to using Users, Roles, and the Security Groups within SuiteCRM specifically.
So, I have a specific setup and I've looked through and read lots of documentation and tried my best to wrap my head around how SuiteCRM does this.
How would one correctly implement the following scenario?:
Let's say I have a tree like so:
We'll number these rows for the sake of understanding: 1, 2, 3 and 4. Then we have Administrators who are employees to throw into the mix.
Administrators can work with almost all records except working with workflows, mess with code, or mess with a few custom modules, outside of that, they have very few restrictions and don't obey any of the rules of the downline.
Then we follow the downline:
Person 1's can see all Person 2's, 3's, and 4's that are specifically within their downline and within their Territory. They cannot see any other Person 1's period. They cannot see any 2's, 3's, and 4's that aren't within their downline or their Territory. They also cannot see Administrators or anything assigned to them.
Person 2's can see all Person 3's and 4's within their specific Downline and Territory, They cannot see any Person 1's or 2's period. They cannot see any Person 3's or 4's outside of their Territory or Downline. They also cannot see Administrators or anything assigned to them.
Person 3's can see all 4's within their specific Downline and Territory, They cannot see any Person 1's, 2's, or other 3's period. They cannot see any Person 4's outside of their Territory or Downline. They also cannot see Administrators or anything assigned to them.
Person 4's can see only records assigned to them.
In this example there is only 4 deep, in the real world, there is actually 12 deep plus administrators plus me, the Super Admin.
How can I go about resolving this?
I wrote SecuritySuite and what you need is fairly typical. There can be a large learning curve for figuring this out so I wrote up an example setup for a 3 deep hierarchy here to try to help with that a bit: https://www.sugaroutfitters.com/docs/securitysuite/example-of-a-typical-setup.
Your example is a 4 deep hierarchy, but it's fairly similar. The key is to create groups for the lowest level. In your case, this would be at the person 4 levels. So person 4a, 4b, 4c would all be in Group A. A role with Owner only rights would be assigned directly to Group A so that 4a/4b/4c could only access their own records.
Person 3a would be in Group A, but a "Manager" role would be created with Group access and assigned directly to person 3a. Person 3a's Group A membership would be marked as non-inheritable so that when person 3a creates a record Group A wouldn't be assigned to it directly. Person 3a would also be in Group AA along with person 3b/3c/3d (according to the picture above).
Person 2b (2nd person in the 2nd tier of the image above) would be in Group A and Group AA, both marked as non-inheritable. Person 2b would have the "Manager" role assigned directly.
Person 1 would have a role assigned directly with "All" access as this person can see everyone.

Need help todesign ER Diagram

How can i design this ER Diagram
The Ministry of Transportation (MOT) supplies department keeps track of all the items (furniture and equipment such as a chair or printer) in the Ministry offices. There are several MOT buildings and each one is given a different name to identify it. Each item is assigned a unique ID when it is purchased. This ID is used to keep track of the item, which is assigned to a room within a building. Each room within a building is assigned to a department, and each department has a single employee as its manager.
i am trying several time but can't understand what to do.If anyone can simplified then it can be much easier for me.

Resources