Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enterprise Data Systems Training WebFOCUS Team

Similar presentations


Presentation on theme: "Enterprise Data Systems Training WebFOCUS Team"— Presentation transcript:

1 Enterprise Data Systems Training WebFOCUS Team
Created by Krista Hapner April 16, 2015

2 What exactly do we (EDS-WebFOCUS Team) do?
What we DON’T do… Our department actually does nothing to the database. (i.e. we don’t insert, delete, or change any of the data already in the database) The Data Warehouse is maintained by a different group within our EDS Department. **Note: There are some rare cases when we make changes to the data in the database, but you can assume for now that we won’t be making any changes in the database** What we Do... Our department creates reports using the tables in the database. We create reports such as a list of all the students registered for the current term. To do this, we would have to create a query to print out the first name and last name of all the students where the term they are registered for is equal to the current term. **Most reports are more complicated than that, that report is just a simple example**

3 If you have not taken Introduction to Systems…
At this point, you need to look through the tutorials to learn SQL. You can do this at the website: If you HAVE taken Introduction to Systems or are familiar enough with SQL.. Continue onto the next slide.

4 Because we use a lot of SQL statements.. Let’s do some review…
First let’s take a look at the SQL server you will be using… It is called “Microsoft SQL Server Management Studio” To start.. Make sure you type the information shown in this picture. We are connecting to pre-production (this will be explained later – there is also a production environment, but for now we are connecting to pre-production)

5 SQL REVIEW For future reference, to connect to a new database engine click on connect->Database Engine. YOU SHOULD SEE THIS SCREEN WHEN YOU LOG IN: Go ahead and click on Databases. You will most likely never need to click on anything else.

6 SQL REVIEW Go ahead and click on Tables.
Right click on the table dbo.dim_student and click Select top 1000 rows. Here is a list of all the databases. The only two you will probably ever use are data_warehouse and fred. (Fred is also known as “Operational Data Store (ODS)”) Click on data_warehouse. You will most likely only need to look at Tables and Views.

7 SQL REVIEW You should see something similar to this:
Not Real Data  You should see something similar to this: You can think of the column name “student_key” as a primary key that can be used to join to other tables. Scroll to the right and look at all the different column names just to familiarize yourself with this table, because you will use it a lot.

8 SQL REVIEW COPY THIS CODE: SELECT TOP 1000 student_key, banner_id, last_name, first_name FROM dim_student WHERE gender = 'M' ORDER BY last_name; We have just created a query to see all the students that have ever attended Taylor University that are Male. **Note, we just selected the top 1000 rows, there are far more than 1000 people.** OKAY.. Let’s create a practice SQL query. Click on “New Query” at the top. Copy and paste the code to the right and then press “Execute.” After you run the code to the right, feel free to practice running your own codes. If you need a SQL refresher visit…

9 Now that we remember SQL..
Actually.. We are mainly going to create reports using a WebFOCUS language that is very SIMILAR to SQL but has differences. There are different types of reports we can create.. A report made entirely of SQL statements A report made entirely of WebFOCUS statements A report made of SQL & WebFOCUS statements We start by creating all reports using the WebFOCUS language, but if we have something complex then we throw in a SQL query, but only if we need to.

10 Intro WebFOCUS8 As a new hiree, you will only need to be introduced to WebFOCUS8. We are in the process of moving reports from WebFOCUS7 to WebFOCUS8. Go ahead and open WebFOCUS 8.. Also known as App Studio. We use two environments called PRE-PRODUCTION, and PRODUCTION (also called PPRD and PROD). We do testing/development in pre-production. Then we move the final version into production. **WE NEVER DEVELOP OR TEST A REPORT IN PRODUCTION**

11 Let’s set up your environments…
We are going to set up two environments. The first one is pre-production or webfocus8pre15. Make sure all information is correct before pressing OK. Click Environments at the top. Click Add.

12 Second Environment The next environment you are going to add is the production environment or webfocussrv15. Make sure all information is correct before pressing OK.

13 Creating a Report Next: Click Create Report.
Let’s create a simple report.. We are going to create it in pre-production. (we will be doing this under Content->Enterprise Data Systems->My content) We are going to start by making a report that is purely WebFOCUS Language. To get started let’s click on Report under the Home tab. Next: Click Create Report.

14 Creating a Report If you look towards the right you should see an area that says Select a Data Source. For practice select car. Then press finish. WELCOME TO THE WEBFOCUS GUI (GRAPHICAL USER INTERFACE). **Definition of a Graphical User Interface: a visual way of interacting with a computer using items such as windows, icons, and menus, used by most modern operating systems** Basically, whatever you do on a GUI generates code “behind the scenes.” To start.. Look towards the bottom and click on a tab called Fields. **Note: “Fields” may already be selected by default.**

15 Creating a Report You should see this… You should see this..
Either Double Click or Drag the following objects onto the blank white area to the right (also known as the canvas): You should see this.. COUNTRY CAR MODEL BODYTYPE DEALER_COST RETAIL_COST You should see this…

16 Now Lets Run this Report..
You should see this… Two ways to Run the report… 1. Click the “Run” Arrow at the very top. 2. Click on the white canvas area and press F5. **Either way is an acceptable way to run the report, it just depends on your preference**

17 Let’s look at the code that the GUI automatically generated..
Click on SOURCE at the very bottom. You should see this

18 Let’s make a SQL report in WebFOCUS.
Click REPORT -> CREATE SQL REPORT -> NEXT -> SELECT “TYPE SQL STATEMENTS IN THIS REPORT REQUEST” Copy this code: SELECT TOP 1000 student_key, banner_id, last_name, first_name FROM dim_student WHERE gender = 'M'; Click NEXT->NEXT. Paste code into the area that says “Enter the SQL statements you want executed below:”

19 SQL Report in WebFOCUS Now Run the report…
Click Next->Finish. Go to the fields section and double click or drag student_key, banner_id, last_name, and first_name onto the canvas. If app studio asks “Alphanumeric field being placed between two numeric fields. What would you like to do?” Select “Add the field as an aggregate.” Make sure you select DETAIL instead of AGGREGATE at the top when adding the fields to the canvas (*Must do for all fields*) Now Run the report…

20 Time to mix WebFOCUS & SQL
Remember how I said you can create reports with both WebFOCUS and SQL code? Let’s add a line of WebFOCUS code to our SQL report we just made. Go to Report -> Source. Underneath PRINT take off the line last_name. Underneath the PRINT statement type BY last_name. This is similar to the SQL code “order by.” When you run the report, you will notice that when you do a BY statement that the last_name column printed first. If we don’t want this to occur we type the following:

21 Learning the WebFOCUS Language
Time to practice on your own. Everything you create will be using the car table like we used earlier. You should open a blank fex, you will be typing code and NOT using the GUI. I will walk you through the basics of WebFOCUS, and provide you with practice problems of your own. The answers will be on the next slide following the problem. Do not peak at the solutions! 

22 Basic Format of a WebFOCUS Request
Structure: TABLE FILE [data source] [Print phrase] [Sort phrase] [Filter phrase] [Output section] [Styling section] END Example: TABLE FILE CAR PRINT COUNTRY CAR BY MODEL WHERE COUNTRY EQ ‘France’ ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * $ ENDSTYLE END We are pulling data from the table “car” We are display the fields “country” & “car” We are sorting by model Filtering – finding only the data set in the CAR table where their country name is “France” The output format will be in HTML. (Other Forms are EXCEL – XLSX, PDF – PDF, ACTIVE REPORT – AHTML) We want the WebFOCUS default style sheet (if you say nothing about style – it will also go to the default)

23 Comparisons In the WHERE statements, you can compare a specific field to a value. For example WHERE COUNTRY EQ ‘France’ Our comparison Operators are: EQ – EQUALS GT – GREATER THAN LT – LESS THAN GE – GREATER THAN OR EQUAL LE- LESS THAN OR EQUAL NE – NOT EQUAL TO In addition we have the LIKE operator. It finds the data values that are similar or equal to your value. Example: WHERE COUNTRY LIKE ‘Fran%’ The % is a wild card. You could put the wildcard before or after the word. The _ is also a wild card. But, the % allows for as many characters to follow, whereas the _ describes a specific amount of wild card characters. Example: Jo% could be – Josh, John, Jon, Joel, Jonathan, etc. Jo_ could only be a name with 3 letters: Jon, etc.

24 AND / OR Operators In the WHERE statements, we can specify multiple conditions in one statement. For example: WHERE COUNTRY EQ ‘England’ AND MODEL EQ ‘Jaguar’ Example: WHERE COUNTRY EQ ‘England’ OR COUNTRY EQ ‘Japan’ Another way to use the AND operator is to have multiple WHERE statements: WHERE COUNTRY EQ ‘England’ WHERE MODEL EQ ‘Jaguar’ Note: When comparing with characters – use ‘single quotes’ or “double quotes” When comparing with numbers you do not need quotes.. Example: WHERE SEATS EQ 2 Also, do not use commas in numbers.

25 Practice Problem #1 1. Print the Country, Car, Body type, Seats, and Dealer Cost. 2. Only display the Cars whose Country begins with EITHER J OR E. 3. Only display the Cars whose Dealer Cost is greater than or equal to 7, Sort by Dealer Cost. 5. Keep the default styling and the output format should be PDF.

26 Answers to #1 Here is what your fex code should look like: Here is what your output should look like:

27 AGGREGATES – SUM, AVE, MAX, MIN, COUNT
Instead of using a PRINT statement, we can use SUM, AVE, MAX, MIN, COUNT to compute aggregate data. To SUM the sales of each COUNTRY we can use this: We can add an “Alias” to Sales to make the title a little more readable to the end user (using AS) – Changed SALES to TOTAL SALES

28 HEADING / FOOTING We can add a title to our report using HEADING (can also add a footer using FOOTING):

29 STYLING BASICS Example: TABLE FILE CAR HEADING “TOTAL SALES” SUM SALES BY COUNTRY ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * TYPE = HEADING, FONT = ARIAL, COLOR=BLUE, SIZE = 12, STYLE = BOLD+ITALIC, $ ENDSTYLE END Basic Syntax: ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * TYPE=type, Property = Value, $ ENDSTYLE

30 MORE STYLING Different types (TYPE = HEADING): REPORT = entire report DATA = Just the columns / rows returned TITLE = column names Different types of properties (COLOR = Red): GRID = ON / OFF – Add/Removes the grid around the data SIZE = 12 – Changes font size COLOR = Red – Changes font color BACKCOLOR = Green – Changes the background color FONT = Arial – Changes the font family STYLE = Bold+Underline – changes the format of the text JUSTIFY = CENTER – positions in the center

31 Practice Problem #2 Find the SUM of Dealer Cost and Retail Cost.
Group by Country. Display a heading titled “Dealer Cost VS Retail Cost per Country” Display a footing titled “As of (todays date)” Add the following Style: Turn the Grid off Make the header purple, font size of 20, font family of Times New Roman, have it be underlined and italic Make the footer gray Make the column titles bold and green

32 ANSWER to #2

33 Subtotal / Grand Total You can add a grand total of sales for all countries: You can add a subtotal of sales per country:

34 NO PRINTS If you noticed on this query: Dealer Cost printed out twice: Also, dealer cost printed first. If you want dealer cost to be displayed last, but you still want to sort by dealer cost, you can use a NOPRINT statement to sort but not display the field. Example: TABLE FILE CAR PRINT COUNTRY CAR DEALER_COST BY DEALER_COST NOPRINT END

35 Practice Problem #3 Display Dealer Cost
Sort by Country and Model but do not display Model Add a subtotal of Dealer Cost for each country and name the subtotal “Total Dealer Cost for” DO NOT display a grand total (search the documentation online to figure this one out) Make the SUBTOTALS stand out from other data (using styling)

36 Answer to #3

37 DEFINES Let’s say you wanted to find the Retail Cost subtracted by the Dealer Cost. We define a “new” field called CALCULATED_DIFFERENCE and display this:

38 DEFINES - Concatenation
We can join two items together using a concatenation. || = strong concatenation – ignores spaces | = weak concatenation – acknowledges spaces To display the country, model:

39 Practice Problem #4 Display Country along with the following define fields: Define a field called CALCULATION with a format of D5 and subtract Retail cost – sales; Define another field called CAR_MODEL with a format of A100. Display the field like this example “Car: Jaguar – Model: V12XKE Auto” Change the styling of the column titles

40 Answer to #4

41 DEFINE FUNCTIONS Within the DEFINE we can use functions specified WebFOCUS. One of the most common functions is the EDIT function. If we want to see the first two letters of a country we can use the edit function.

42 DEFINE FILE – IF STATEMENTS
We can use conditionals in our defines. For example, we can create a field that displays the words “4 Seats” if seats = 4, “2 Seats” if seats = 2, and if the number of seats do not match either of those conditions (ex: if seats = 5) then we can set it to a default of “more than 4 seats.”

43 Problem #5 Display the following define fields:
Display the first 3 letters of the body type. Create a field titled “Large Sales.” If the number of sales is greater than 10,000 display the value “LARGE SALE!” otherwise display nothing. Display the SALES field next to the LARGE_SALES field. Calculate the volume (length * width * height)

44 Answer to #5

45 STOP! Don’t continue until you have thoroughly gone through the practice problems!

46 Now that you have finished going through the training books…
Let me first introduce you to a couple things… When you cannot figure something out there are two important places you can go to look for information about WebFOCUS. The first is the WebFOCUS Documentation.. This has very important information about the functions you can do in webFOCUS. If you ever have a question about how to do something this is a good place to look. The second is the WebFOCUS Forums.. Chances are, that if you are having a problem, someone else has already had the same one. You can search through these forums to find the answer to a lot of the problems you will have. **If you have questions about either of these tools, feel free to ask**

47 “Real Life Report” This report is going to have several parts, I will explain each part in a separate slide. It is important that you utilize ALL available resources before you ask a question because we would really like to get you thinking for yourself and searching through App Studio to try and familiarize yourself with it. However, we do realize this is all new to you and once you are completely stumped feel free to ask questions. You can use a combination of both the GUI and the Source Code. Try to do as much as you can with the GUI because by now you aren’t as familiar with it. Check with me when you think you are done with each part, if you are correct then you can move onto the next part.

48 Here is an example of what your final product HTML might look like:

49 Part 1 (The basic foundation)
Create a report listing all the students Last Name and First Name and their state and nation. Get the report to print out student Last Name, First Name with a comma in between. (i.e. Smith, Mandy) Get the report to print out either the students State or Nation. If a student doesn’t have a state (i.e. they are from the Bahamas) then print out nation, otherwise print out the state. Sort the data by Last Name and then First Name. Sort the data so that only current students are displayed.

50 Part 2 (The html) Create an HTML page
Allow user to select any term to search the data that they want from a drop-down menu. Allow the user to select any State OR Nation from a list box. **CATCH: You must only display the state or nations of students from whatever term the user previously selected.** After clicking on the things above, the user should be able to run the report to see all the students during a certain term in a certain state or nation. (i.e. all the students during the term Fall 2014 who live in Indiana) 3. Display a description of the term and state in the header depending on what the user selects. (i.e. “All the students during the term: Fall that live in: Indiana”)

51 Part 3 (Sorting) Allow the option to order/sort by Last Name or by State/Nation. If the user chooses to sort by State/Nation, make sure their state/nation displays before the name. VISE VERSA. Allow the user to select multiple terms and multiple states/nations. Make sure the header displays all the terms and all the states/nations selected.

52 Part 4 (Search option) Include a search box for last name.
Include a search box for first name. Make sure the search boxes can sort through the data regardless of capitalization. Also, make sure the search boxes can search through the data when the user enters only part of a name. (Ex: If user enters ‘Jo’ in the first name search box, it should find users with the first name John, Josh, Jonathan, Joshua, Joe, etc.)

53 Part 5 (Pictures) Drill down to a PDF containing a picture of the student the user clicks on. Display the student’s first name and last name on the PDF. Should look something like this: Smith, Mandy Africa Name: Mandy Smith **Note: For bonus points, you could also display the students state/nation along with their name.** output User wants to see a picture of student “Mandy Smith.” After clicking on Mandy’s name (which should look like a link), Mandy’s picture pops up in a PDF displaying her name and picture.

54 Part 6 (Term Editing) The CURRENT TERM needs to be selected by default in the drop-down menu. **NOTE: The current term gets updated each semester so it would be a bad idea to “hard-code” the current term’s term code. ** 2. Show only terms whose term code end in zero. HINT: You might want to look at current_term_view.

55 Part 7 – Finishing Touches
Add Style *Feel free to add more styling than what is required below* -Different Font -Different Colors Make sure everything works if you don’t select anything (i.e. as soon as you run the html page, you should be able to run the report without searching for last name, and the current term should automatically be selected, etc.)

56 You have made it through the basic training!
Now for the real work…. 


Download ppt "Enterprise Data Systems Training WebFOCUS Team"

Similar presentations


Ads by Google