Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc.

Similar presentations


Presentation on theme: "Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc."— Presentation transcript:

1 Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc

2 Hidden Gems Where We Will Look  … in Settings  Coping with PDF and unix  Simplifying and controlling echo  DBA and connections  … in Connections  Combining tables based on ranges  Connecting tables with nothing in common  … in Expressions  Working with more than one record instance at a time  Writing to multiple files simultaneously  Creating your own business related functions  … in Sorting  Automatic summary column creation

3 Copyright 2007, Information Builders. Slide 3 Hidden Gems …In Settings Coping with PDF and unix Simplifying ECHO DBA and connections

4 Copyright 2007, Information Builders. Slide 4 Hidden Gems …In Settings  PDFLINETERM  DEFECHO  DBASOURCE

5 Hidden Gems SET Parameters  Switches that affect behavior – scope varies  You can set at multiple levels  EDASPROF  Group/User Profile  Focexec  Request  Look at the difference in behavior to see when to apply them

6 Corrupt PDF Hidden Gems SET Parameters – PDFLINETERM  Truly hidden – not available currently in SET tool  To eliminate corrupt PDF files that pass through UNIX systems in distribution.  Adds additional space to account for the difference in new line indicator. SET PDFLINETERM=OFF | ON PDF UNIXUNIX

7  &ECHO allows tracing of WebFOCUS execution  -SET &ECHO – local variable requires setting in each script  Provides setting for default value of &ECHO  Default value is used in all INCLUDEd and EXECuted fexes unless –SET issued  Trace appears in View Source window Hidden Gems SET Parameters – DEFECHO SET DEFECHO=OFF | ON | ALL | NONE

8 Hidden Gems SET Parameters – DEFECHO SET DEFECHO=OFF | ON | ALL | NONE One setting controls all – NONE – Prevents unauthorized use of ECHO. Cannot be reset OFF – No tracing of WebFOCUS stack ON – Tracing of WebFOCUS stack only ALL – Tracing of WebFOCUS stack and Dialogue Manager (including &variable substitution)

9  Controls which DBA is applied to in JOIN structure  Default value – HOST - Applies DBA from HOST file only  Value – ALL – Applies DBA from both files if present  Access control – FILE, SEGMENT, FIELD, VALUE  DBA converted to selection criteria and optimized Hidden Gems SET Parameters – DBASOURCE XREFHOST JOIN DBA1 DBA2

10 Copyright 2007, Information Builders. Slide 10 Hidden Gems …In Connections Connect files based on a range of values Connect files with NO apparent connection

11 Copyright 2007, Information Builders. Slide 11 Hidden Gems Connection Standard JOIN based upon equality selection EMPLOYEE ID LAST NAME FIRST NAME HIRE DATE CURRENT SALARY … Employee TAX YEAR TAX RATE MINIMUM SALARY MAXIMUM SALARY Tax Rate JOIN field IN file TO ALL field IN file AS name

12 Copyright 2007, Information Builders. Slide 12 Hidden Gems Connect Based on Equality

13 Copyright 2007, Information Builders. Slide 13 Hidden Gems Connect Based on Equality

14 Copyright 2007, Information Builders. Slide 14 Hidden Gems Connect Based on Equality

15 Copyright 2007, Information Builders. Slide 15 Hidden Gems Connect Based on Range of Values Connection can also be based upon range - LE, LT, GE, GT, NE or FROM /TO EMPLOYEE ID LAST NAME FIRST NAME HIRE DATE CURRENT SALARY … EMPLOYEE TAX YEAR TAX RATE MINIMUM SALARY MAXIMUM SALARY TAX RATE JOIN FILE file AT field TO ALL FILE file AT field AS name WHERE condition

16 Copyright 2007, Information Builders. Slide 16 Hidden Gems Connect Based on Range

17 Copyright 2007, Information Builders. Slide 17 Hidden Gems Insurance Rates – Listing MINIMUM AGE PIN BIRTHDATE BAGE RATE_PER_THOUSAND ----------- --- --------- ---- ----------------- 20 000001020 07/24/1975 26 $8 000001030 04/17/1978 23 $8 000001040 05/07/1977 24 $8 000001050 03/20/1978 24 $8 000001060 03/06/1979 23 $8 000001070 03/10/1981 21 $8 000001090 04/08/1979 22 $8 000001120 04/08/1979 22 $8 000001140 04/24/1978 23 $8 27 000001010 07/17/1972 29 $9 00000108W 02/19/1974 28 $9 000001100 05/21/1973 28 $9 000001110 05/16/1974 27 $9 36 000000010 07/20/1959 42 $11 000000040 05/08/1960 41 $11 MINIMUM AGE PIN BIRTHDATE BAGE RATE_PER_THOUSAND ----------- --- --------- ---- ----------------- 20 000001020 07/24/1975 26 $8 000001030 04/17/1978 23 $8 000001040 05/07/1977 24 $8 000001050 03/20/1978 24 $8 000001060 03/06/1979 23 $8 000001070 03/10/1981 21 $8 000001090 04/08/1979 22 $8 000001120 04/08/1979 22 $8 000001140 04/24/1978 23 $8 27 000001010 07/17/1972 29 $9 00000108W 02/19/1974 28 $9 000001100 05/21/1973 28 $9 000001110 05/16/1974 27 $9 36 000000010 07/20/1959 42 $11 000000040 05/08/1960 41 $11 Problem: Selecting the correct insurance rate based upon age from a table with ranges--- Minimum Maximum Age AgeInsurance Rate 21 27 $ 8.00 28 34 $ 9.00 35 40 $10.00 41 44 $11.00

18 Copyright 2007, Information Builders. Slide 18 Hidden Gems In Connections - Insurance Rates JOIN FILE EMPDATA1 AT BIRTHDATE TO ALL FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; WHERE EMPDATA1.BAGE LE RATES.EAGE; END TABLE FILE EMPDATA1 HEADING "To: <FIRSTNAME <LASTNAME " "</1 Thank you for choosing our company for your <0X insurance needs." "Thank you for choosing our company for your insurance needs.” "Since your birth date is <BIRTHDTATE,your current rate is<0X <RATE_PER_THOUSAND per" "unit of coverage. This is your rate through age <EAGE. “ ON TABLE SET PAGE OFF BY PIN NOPRINT PAGE-BREAK END JOIN FILE EMPDATA1 AT BIRTHDATE TO ALL FILE RATES AT AGE AS J1 WHERE EMPDATA1.BAGE GE RATES.AGE; WHERE EMPDATA1.BAGE LE RATES.EAGE; END TABLE FILE EMPDATA1 HEADING "To: <FIRSTNAME <LASTNAME " "</1 Thank you for choosing our company for your <0X insurance needs." "Thank you for choosing our company for your insurance needs.” "Since your birth date is <BIRTHDTATE,your current rate is<0X <RATE_PER_THOUSAND per" "unit of coverage. This is your rate through age <EAGE. “ ON TABLE SET PAGE OFF BY PIN NOPRINT PAGE-BREAK END Greater than Minimum Age Less than Maximum Age

19 Copyright 2007, Information Builders. Slide 19 Hidden Gems In Connections  Connect files that have NO apparent connection Employee Salary History New Car Finance Packages JOIN?

20 Copyright 2007, Information Builders. Slide 20 Hidden Gems In Connections

21 Copyright 2007, Information Builders. Slide 21 Hidden Gems In Connections Employee Salary History New Car Finance Packages JOIN?

22 Copyright 2007, Information Builders. Slide 22 Hidden Gems In Connections Conditional Join Considerations:  Cartesian product  WHERE condition controls selection  Complex WHEREs supported  Multiple WHERE conditions  WHERE must contain fields from both files  Remove WHERE – true cartesian product  Range-based JOIN in the tool  Join with no common fields in text mode

23 Copyright 2007, Information Builders. Slide 23 Hidden Gems In Expressions  Writing to multiple files simultaneously  Working with more than one record instance at a time  Creating your own business related functions

24 Copyright 2007, Information Builders. Slide 24 Hidden Gems In Expressions  Working with more than one record instance at a time  Available in COMPUTE, DEFINE, WHERE  References the field value in the previous record  Works with real and virtual fields THE FUNCTION

25 Copyright 2007, Information Builders. Slide 25 Hidden Gems In Expressions

26 Copyright 2007, Information Builders. Slide 26 Hidden Gems In Expressions 1. Select LAST 2. Get Fieldname

27 Copyright 2007, Information Builders. Slide 27 Hidden Gems In Expressions In DEFINE

28 Copyright 2007, Information Builders. Slide 28 Hidden Gems In Expressions In DEFINE

29 Copyright 2007, Information Builders. Slide 29 Hidden Gems In Expressions In COMPUTE

30 Copyright 2007, Information Builders. Slide 30 Hidden Gems In Expressions  Same as DEFINE  Operates on matrix  Processes same or fewer records than DEFINE In COMPUTE

31 Copyright 2007, Information Builders. Slide 31 Hidden Gems In Expressions In WHERE CAR.ORIGIN.COUNTRY NE LAST CAR.ORIGIN.COUNTRY

32 Copyright 2007, Information Builders. Slide 32 Hidden Gems In Expressions In WHERE  Failed?  Multiple Country’s  Why?  Order is important  DEFINE order is the order of READ

33 Copyright 2007, Information Builders. Slide 33 Hidden Gems In Expressions In WHERE  Data in matrix sorted  WHERE TOTAL on COMPUTE  Results?

34 Copyright 2007, Information Builders. Slide 34 Hidden Gems In Expressions In WHERE  Ta Da!

35 Copyright 2007, Information Builders. Slide 35 Hidden Gems In Expressions In WHERE Using LAST:  Detecting value changes of data in ordered sets  Nested IF…THEN…ELSE  Create new sort-able select-able groups  Creating identifiers based on ordered fields  DEFINE - BY / WHERE  COMPUTE - BY TOTAL / WHERE TOTAL  Creating running values on any fields  Totals, Averages, Margins, Any calculation  Holding preceding data values for calculation In DEFINE In COMPUTE

36 Copyright 2007, Information Builders. Slide 36 Hidden Gems In Expressions In WHERE LAST Considerations:  The order the data is processed is critical  You may need to presort data to a hold file  Not optimizable to relational databases  DEFINES work with WHERE  COMPUTES work with WHERE TOTAL In DEFINE In COMPUTE

37 Hidden Gems In Expressions  Writing to multiple files simultaneously  To create a log of specific data values read Which customers placed orders?  To create of record of calculated values Will I go out of stock on any these orders?  To create additional output What page number will this item be on? PUTDDREC

38 Hidden Gems In Expressions PUTDDREC syntax: PUTDDREC(ddname, dd_len, record_string, record_len, outfield) ddname - ddname assigned by filedef to output file dd_len - length of the ddname record_string - string of characters to write to file or field containing that string record_len - length of the string to be included outfield - return code  Output file must be filedef’d  DEFINE/COMPUTE field format always I1  Handles open, write and close

39 Hidden Gems In Expressions FILEDEF PUTDD1 DISK putdd1.dat TABLE FILE EMPLOYEE PRINT EMP_ID CURR_JOBCODE AS 'JOB' CURR_SAL COMPUTE SALA/A12 = EDIT(CURR_SAL); NOPRINT COMPUTE EMP1/A50= LAST_NAME|FIRST_NAME|EMP_ID|CURR_JOBCODE|SALA; NOPRINT COMPUTE OUT1/I1 = PUTDDREC('PUTDD1',6, EMP1, 50, OUT1); BY LAST_NAME BY FIRST_NAME END PUTDDREC in Action

40 Hidden Gems In Expressions LAST_NAME FIRST_NAME EMP_ID JOB CURR_SAL OUT1 --------- ---------- --------- --- -------- ---- BANNING JOHN 119329144 A17 $29,700.00 0 BLACKWOOD ROSEMARIE 326179357 B04 $21,780.00 0 CROSS BARBARA 818692173 A17 $27,062.00 0 GREENSPAN MARY 543729165 A07 $9,000.00 0 IRVING JOAN 123764317 A15 $26,862.00 0 JONES DIANE 117593129 B03 $18,480.00 0 MCCOY JOHN 219984371 B02 $18,480.00 0 MCKNIGHT ROGER 451123478 B02 $16,100.00 0 ROMANS ANTHONY 126724188 B04 $21,120.00 0 SMITH MARY 112847612 B14 $13,200.00 0 RICHARD 119265415 A01 $9,500.00 0 STEVENS ALFRED 071382660 A07 $11,000.00 0 Report Created

41 Hidden Gems In Expressions BANNING JOHN 119329144A17000000029700 BLACKWOOD ROSEMARIE 326179357B04000000021780 CROSS BARBARA 818692173A17000000027062 GREENSPAN MARY 543729165A07000000009000 IRVING JOAN 123764317A15000000026862 JONES DIANE 117593129B03000000018480 MCCOY JOHN 219984371B02000000018480 MCKNIGHT ROGER 451123478B02000000016100 ROMANS ANTHONY 126724188B04000000021120 SMITH MARY 112847612B14000000013200 SMITH RICHARD 119265415A01000000009500 STEVENS ALFRED 071382660A07000000011000 Sequential File Created

42 Hidden Gems In Expressions PUTDDREC Considerations:  Create fixed data file to fit a specific Master file  Create comma-delimited data file for loading  System and User &variables are available  &MDYY, &FOCCPU, &FOCUSER, etc  Write control at any point or multiple points  Write to multiple PUTDDREC files in a request

43 Hidden Gems In Expressions Creating an Index in PDF with PUTDDREC 1. Create a filedef for the index output file. 2. Create request that you want to index. 1. Including HOLD to PDF 2. Including all styling required 3. Add NOPRINTED COMPUTE that – 1. Tests for a change of sort break 2. Uses PUTDDREC to put values in file  &TABPAGENO  Sort Break Value 4. Create pdf index request using index output 5. Run original request as compound pdf, followed by index request, creating single pdf.

44 Y Hidden Gems In Expressions  Standardization  Corporate business logic  FOCUS/WebFOCUS coding standards  Simplification  Complicated groups of expressions  Repeated groups of expressions  Creation  New subroutines currently unavailable  Customization of existing functions  Based on the FOCUS/WebFOCUS language  Creating your own business related functions

45 Hidden Gems In Expressions The Syntax of FUNCTIONS - 1 DEFINE FUNCTION name (arg1/format,…argn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END DEFINE FUNCTION name (arg1/format,…argn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END  Name of function = Last field calculated in function.  Returns value to calling procedure.  Name of function = Last field calculated in function.  Returns value to calling procedure.  Arguments and formats that are used when the function is called.  Fields actually used in call must match the type indicated – alpha or numeric.  Alpha Too short – space padded Too long – truncated  Arguments and formats that are used when the function is called.  Fields actually used in call must match the type indicated – alpha or numeric.  Alpha Too short – space padded Too long – truncated

46 Hidden Gems In Expressions The Syntax of FUNCTIONS - 2 DEFINE FUNCTION name (argument1/format,…argumentn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END DEFINE FUNCTION name (argument1/format,…argumentn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END  Intermediate fields use in calculation of final result.  Unlimited number  Use arguments, constants and other temporary fields declared in the function.  Use all operators and most functions  Intermediate fields use in calculation of final result.  Unlimited number  Use arguments, constants and other temporary fields declared in the function.  Use all operators and most functions

47 Hidden Gems In Expressions The Syntax of FUNCTIONS - 3 DEFINE FUNCTION name (argument1/format,…argumentn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END DEFINE FUNCTION name (argument1/format,…argumentn/formatn) [tempvariablea/formata = expressiona;]. [tempvariablen/formatn = expressionn;] name/format = [result_expression]; END  Final field defines the value returned.  Name must match name of function.  Format indicates the format returned.  Final field defines the value returned.  Name must match name of function.  Format indicates the format returned.

48 Hidden Gems In Expressions MARGIN Function DEFINE FUNCTION MARGIN CLEAR DEFINE FUNCTION MARGIN (RC/D7, DC/D7) NETPROFIT/D7=RC-DC; MARGIN/D5.2=(NETPROFIT*100)/DC; END TABLE FILE CAR PRINT COUNTRY CAR MODEL SALES AND COMPUTE MARGIN/D5.2 = MARGIN(RETAIL_COST,DEALER_COST); WHERE MARGIN(RETAIL_COST, DEALER_COST) GT 20 END DEFINE FUNCTION MARGIN CLEAR DEFINE FUNCTION MARGIN (RC/D7, DC/D7) NETPROFIT/D7=RC-DC; MARGIN/D5.2=(NETPROFIT*100)/DC; END TABLE FILE CAR PRINT COUNTRY CAR MODEL SALES AND COMPUTE MARGIN/D5.2 = MARGIN(RETAIL_COST,DEALER_COST); WHERE MARGIN(RETAIL_COST, DEALER_COST) GT 20 END

49 Y Hidden Gems In Expressions  Easily accessed throughout WebFOCUS  Connected to Master File?  DF. Operator  Dynamic load and run of function  Function location indicated  Additional characteristics available  Description Functions in Master Files?

50 Hidden Gems In Expressions

51

52

53

54

55 DEFINE FUNCTION DMDATFMT DESCRIPTION 'Convert date to 2008-JUL-04 format‘ (INDATE/YYMD) CONVDATE/A8YYMD=DATECVT(INDATE, 'YYMD', 'A8YYMD'); DMDATFMT/A11=CHGDAT( 'YYMD', 'YYMTD', CONVDATE, 'A11' ); END DEFINE FUNCTION DMPROPER DESCRIPTION 'Convert name to proper case and last, first format‘ (LASTNAME/A17, FIRSTNAME/A14) DMPROPER/A34V=LCWORD(17, LASTNAME, 'A17') || (', ' | LCWORD(14, FIRSTNAME, 'A14')); END DEFINE FUNCTION DMDATFMT DESCRIPTION 'Convert date to 2008-JUL-04 format‘ (INDATE/YYMD) CONVDATE/A8YYMD=DATECVT(INDATE, 'YYMD', 'A8YYMD'); DMDATFMT/A11=CHGDAT( 'YYMD', 'YYMTD', CONVDATE, 'A11' ); END DEFINE FUNCTION DMPROPER DESCRIPTION 'Convert name to proper case and last, first format‘ (LASTNAME/A17, FIRSTNAME/A14) DMPROPER/A34V=LCWORD(17, LASTNAME, 'A17') || (', ' | LCWORD(14, FIRSTNAME, 'A14')); END Contents of dmfns.fex

56 Hidden Gems In Expressions

57

58

59 AGENT1 AGENT_TALK AGENT_TALK1 TTIME TTIME1 ALLEN 200 300 00:03:20 00:05:00 BILL 300 400 00:05:00 00:06:40 CARL 620 520 00:10:20 00:08:40 DAN 400 901 00:06:40 00:15:01 --------------------------------------------------------- TOTAL 1520 2121 00:25:20 00:35:21 We Need A Report That Reads Times In Seconds, PROBLEM : Adds Them And Converts To Hours : Minutes : Seconds

60 DEFINE FUNCTION HRMISC (SEC/I10) -* CALCULATE HOURS HR/I2 = SEC/3600; HR_R/I2 = SEC -(HR* 3600) ; -* CALCULATE MIN MI/I2 = (HR_R / 60); -* CALCULATE SECONDS SC_D/I2 = SEC -((MI * 60) + HR); HRMISC/A8 = EDIT(HR) || ':' || EDIT(MI) || ':' || EDIT(SC_D) ; END DEFINE FUNCTION HRMISC (SEC/I10) -* CALCULATE HOURS HR/I2 = SEC/3600; HR_R/I2 = SEC -(HR* 3600) ; -* CALCULATE MIN MI/I2 = (HR_R / 60); -* CALCULATE SECONDS SC_D/I2 = SEC -((MI * 60) + HR); HRMISC/A8 = EDIT(HR) || ':' || EDIT(MI) || ':' || EDIT(SC_D) ; END Hidden Gems In Expressions SOLUTION :

61 Copyright 2007, Information Builders. Slide 61 Hidden Gems In Sorting  Automatic summary column creation

62 Hidden Gems In Sorting TABLE FILE GGSALES SUM UNITS AS 'UNITS' DOLLARS AS 'DOLLARS' BY PRODUCT BY REGION BY DATE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; ON DATE SUB-TOTAL AS 'REGION TOTAL' ON TABLE SUB-TOTAL END TABLE FILE GGSALES SUM UNITS AS 'UNITS' DOLLARS AS 'DOLLARS' BY PRODUCT BY REGION BY DATE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; ON DATE SUB-TOTAL AS 'REGION TOTAL' ON TABLE SUB-TOTAL END You know the effect of SUB-TOTAL on a BY field… Product Region Date UNITS DOLLARS ------- ------ ---- ----- ------- Capuccino Northeast 1997/08/01 1473 19486 REGION TOTAL 1997/08/01 1473 19486. REGION TOTAL 1997/12/01 1188 13668 *TOTAL REGION Northeast 11551 144742. Product Region Date UNITS DOLLARS ------- ------ ---- ----- ------- Capuccino Northeast 1997/08/01 1473 19486 REGION TOTAL 1997/08/01 1473 19486. REGION TOTAL 1997/12/01 1188 13668 *TOTAL REGION Northeast 11551 144742.

63 Hidden Gems In Sorting TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUB-TOTAL AS 'REGION' ON TABLE SUB-TOTAL WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUB-TOTAL AS 'REGION' ON TABLE SUB-TOTAL WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END Now see the effect of SUB-TOTAL on an ACROSS field… Region Midwest West TOTAL MNTH Product NOV DEC REGION NOV DEC REGION ------- --- --- ------ --- --- ------ ----- Capuccino UNITS... 2535 4051 6586 6586 DOLLARS... 31153 57421 88574 88574 Espresso UNITS 2186 1752 3938 3088 3732 6820 10758 DOLLARS 27526 22281 49807 36123 51400 87523 137330 TOTAL UNITS 2186 1752 3938 5623 7783 13406 17344 DOLLARS 27526 22281 49807 67276 108821 176097 225904 Region Midwest West TOTAL MNTH Product NOV DEC REGION NOV DEC REGION ------- --- --- ------ --- --- ------ ----- Capuccino UNITS... 2535 4051 6586 6586 DOLLARS... 31153 57421 88574 88574 Espresso UNITS 2186 1752 3938 3088 3732 6820 10758 DOLLARS 27526 22281 49807 36123 51400 87523 137330 TOTAL UNITS 2186 1752 3938 5623 7783 13406 17344 DOLLARS 27526 22281 49807 67276 108821 176097 225904

64 Hidden Gems In Sorting TABLE FILE GGSALES SUM UNITS AS 'UNITS' DOLLARS AS 'DOLLARS' COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT BY REGION BY DATE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; ON DATE SUMMARIZE AS 'REGION TOTAL' ON TABLE SUMMARIZE END TABLE FILE GGSALES SUM UNITS AS 'UNITS' DOLLARS AS 'DOLLARS' COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT BY REGION BY DATE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; ON DATE SUMMARIZE AS 'REGION TOTAL' ON TABLE SUMMARIZE END You know the effect of SUMMARIZE on a BY field… Product Region Date UNITS DOLLARS UNIT PRICE ------- ------ ---- ----- ------- ---------- Capuccino Northeast 1997/08/01 1473 19486 13 REGION TOTAL 1997/08/01 1473 19486 13. REGION TOTAL 1997/12/01 1188 13668 11 *TOTAL REGION Northeast 11551 144742 12 Product Region Date UNITS DOLLARS UNIT PRICE ------- ------ ---- ----- ------- ---------- Capuccino Northeast 1997/08/01 1473 19486 13 REGION TOTAL 1997/08/01 1473 19486 13. REGION TOTAL 1997/12/01 1188 13668 11 *TOTAL REGION Northeast 11551 144742 12

65 Hidden Gems In Sorting TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUMMARIZE AS 'REGION' ON TABLE SUMMARIZE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUMMARIZE AS 'REGION' ON TABLE SUMMARIZE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END Now see the effect of SUMMARIZE on an ACROSS field… Region Midwest West TOTAL MNTH Product NOV DEC REGION NOV DEC REGION ------- --- --- ------ --- --- ------ ----- Capuccino UNITS... 2535 4051 6586 6586 DOLLARS... 31153 57421 88574 88574 UNIT PRICE... 12 14 13 13 Espresso UNITS 2186 1752 3938 3088 3732 6820 10758 DOLLARS 27526 22281 49807 36123 51400 87523 137330 UNIT PRICE 12 12 12 11 13 12 12 TOTAL UNITS 2186 1752 3938 5623 7783 13406 17344 DOLLARS 27526 22281 49807 67276 108821 176097 225904 UNIT PRICE 12 12 12 11 13 13 13 Region Midwest West TOTAL MNTH Product NOV DEC REGION NOV DEC REGION ------- --- --- ------ --- --- ------ ----- Capuccino UNITS... 2535 4051 6586 6586 DOLLARS... 31153 57421 88574 88574 UNIT PRICE... 12 14 13 13 Espresso UNITS 2186 1752 3938 3088 3732 6820 10758 DOLLARS 27526 22281 49807 36123 51400 87523 137330 UNIT PRICE 12 12 12 11 13 12 12 TOTAL UNITS 2186 1752 3938 5623 7783 13406 17344 DOLLARS 27526 22281 49807 67276 108821 176097 225904 UNIT PRICE 12 12 12 11 13 13 13 SUB-TOTAL SUBTOTAL SUMMARIZE RECOMPUTE

66 Hidden Gems In Sorting TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUMMARIZE AS 'REGION' ON TABLE SUMMARIZE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END TABLE FILE GGSALES SUM UNITS AS 'UNITS' OVER DOLLARS AS 'DOLLARS' OVER COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT PRICE' BY PRODUCT ACROSS REGION ACROSS DATE ON DATE SUMMARIZE AS 'REGION' ON TABLE SUMMARIZE WHERE DATE FROM 19970801 TO 19971231; WHERE PRODUCT EQ 'Capuccino' OR 'Espresso'; END  Currently requires text mode  Triggered with ON SUMMARIZE AS ‘title’  Style as DATA, OBJECT, or COLUMN

67 Hidden Gems Where We Looked Coping with PDF and unix Simplifying and controlling echo DBA and connections Combining tables based on ranges Connecting tables with nothing in common Working with more than one record instance at a time Writing to multiple files simultaneously Creating your own business related functions Automatic summary column creation Questions?


Download ppt "Copyright 2007, Information Builders. Slide 1 Hidden Gems Walter F. Blood Technical Director Information Builders, Inc."

Similar presentations


Ads by Google