Presentation is loading. Please wait.

Presentation is loading. Please wait.

Noreen Redden FOCUS Users of New England 2012 FOCWizards and Focal Point Information Builders Off to See the Wizards 1.

Similar presentations


Presentation on theme: "Noreen Redden FOCUS Users of New England 2012 FOCWizards and Focal Point Information Builders Off to See the Wizards 1."— Presentation transcript:

1 Noreen Redden FOCUS Users of New England 2012 FOCWizards and Focal Point Information Builders Off to See the Wizards 1

2 Techniques – Of Course 2

3 Techniques 3  Customer Asked:  A Report totals sales by Product Code within Region.  We also need to get the total Sales for each Product Code, regardless of Region.  Can I do this all in One Report, and one pass through the Data?  Our Answer:  Of course, there is always the McGyver Way.  Previous Limitations of McGyver  Using a Generated Key field, means that we need different headings for the within Region report and the totals report.  In previous releases, we did this with SUBHEAD, but that required also spelling out column headings, difficult with ACROSS  Also, some of the ACROSS values may be empty for particular regions, causing yet more complications.

4 McGyver 4 McGyver Technique: 1. Create a file with Counters. 2. Duplicate each Sales record as many times as needed to create the different types of reports 3. Use DEFINE to specify parameters for each section. Sales Record counter Sale #1 REGION X Copy 1Copy 2 Sale #2 REGION Y Copy 1Copy 2 DEFINE SRT REGION XREGION YTOTAL

5 McGyver 5 TABLE FILE SYSCOLUM PRINT COMPUTE CONTROL/A1 = 'X'; TBNAME WHERE RECORDLIMIT EQ 1 ON TABLE SAVE AS FOCMCGYV END JOIN CONTROL WITH DIV IN EMPDATA TO BLANK IN FOCMCGYV AS AJ END DEFINE FILE EMPDATA CONTROL/A1 WITH DIV = 'X'; SRT/A13 = IF ORDER EQ 1 THEN AREA ELSE 'Total'; CLASS/A3 = EDIT(JOBCLASS,'999'); END 1 2 3

6 McGyver 6 SET HIDENULLACRS = ON TABLE FILE EMPDATA SUM SALARY ACROSS CLASS AS 'Job Class' BY ORDER NOPRINT PAGE-BREAK BY SRT NOPRINT PAGE-BREAK BY DEPT IF ORDER EQ 1 OR 2 HEADING "Salaries For Area: <SRT " WHEN ORDER EQ 1; HEADING "Salaries For All Areas " WHEN ORDER EQ 2; END

7 Salaries For Area: NORTH EASTERN Job Class 019257389 DEPT CUSTOMER SUPPORT$62,500.00.$19,300.00 MARKETING.$139,800.00. SALES.$82,600.00. Salaries For Area: SOUTH EASTERN Job Class 019064229 DEPT CONSULTING.$85,400.00. CUSTOMER SUPPORT$62,500.00.. MARKETING... PERSONNEL$80,500.00.. PROGRAMMING & DVLPMT..$49,000.00 McGyver 7

8 Salaries For All Areas Job Class 019 064229 DEPT ACCOUNTING $224,500.00.. ADMIN SERVICES... CONSULTING.$126,300.00. CUSTOMER SUPPORT $179,100.00.. MARKETING $62,500.00.. PERSONNEL $125,500.00.. PROGRAMMING & DVLPMT..$182,300.00 SALES$239,100.00... McGyver 8

9 Job Class 257389.$58,800.00.$56,200.00...$19,300.00 $508,200.00..$91,300.00.. $156,100.00. McGyver 9

10 Techniques 10  Customer Asked: I want to combine values from multiple records into a single line (or lines) for the same key value.  Our Answer:  If the records are sorted by the key, use DEFINE followed by SUM:, if not sorted, COMPUTE with WHERE TOTAL  As it is Built key rec1comment key rec1comment rec2comment key rec1comment rec2comment rec3comment * After SUM or WHERE TOTAL key rec1comment rec2comment rec3comment

11 Combining 11 SET CNOTATION = EXPLICIT SET DROPBLNKLINE = ON DEFINE FILE EMPDATA CNTIT/I1 WITH PIN = 1; END TABLE FILE EMPDATA PRINT SUM.CNTIT WITHIN AREA NOPRINT COMPUTE CTR/I3 = IF AREA EQ LAST AREA THEN CTR + 1 ELSE 1; NOPRINT COMPUTE ALLEM1/A63V = IF CTR EQ 1 THEN PIN ELSE IF CTR LE 7 THEN ALLEM1 | ' ' | PIN ELSE ALLEM1; AS '' OVER COMPUTE ALLEM2/A63V= … COMPUTE FLAG/A1 = IF C2 EQ C1 THEN 'Y' ELSE 'N'; NOPRINT BY AREA NOPRINT SUBHEAD "Employees for Area <AREA " WHERE TOTAL FLAG EQ 'Y' END

12 Employees for AreaCENTRAL 000000040 000000050 000000180 000000200 000000240 000000250 000000290 000000360 000000390 Employees for AreaCORPORATE 000000010 000000070 000000100 000000130 000000300 000000320 000000400 Employees for AreaNORTH EASTERN 000000060 000000110 000000140 000000190 000000210 000000310 Employees for AreaSOUTH EASTERN 000000020 000000120 000000160 000000220 000000230 000000280 Employees for AreaWESTERN 000000030 000000080 000000090 000000150 000000170 000000270 000000340 000000350 Combining 12

13 Averages  Customer Asked:  Does FOCUS give me a weighted average, or a non-weighted average?  Our Answer:  Actually Both  Types of averages  Weighted (some values participate more than others)  Non-weighted (all values participate equally) 13

14 Averages  Example Using ACROSS TABLE FILE EMPDATA SUM CNT.SALARY NOPRINT SALARY NOPRINT COMPUTE AVE1/D8.2M = SALARY/CNT.SALARY ; AS '' ACROSS BLANK NOPRINT ACROSS AREA BY TYPDEP/R ROWS 1 AS 'ADMIN' OVER 2 AS SLS/MARKT' OVER 3 AS 'PROGRAM' OVER 4 AS 'PROF SRVCS' ON BLANK SUMMARIZE AS 'weighted ' ON AREA SUBTOTAL AVE. AS 'average' END 14

15 Averages AREA CENTRAL CORPORATE NORTH EASTERN SOUTH EASTERN ------------------------------------------------------------------ ADMIN $32,175.00 $56,660.00. $80,500.00 SLS/MARKT $68,650.00 $51,066.67 $44,480.00 $56,500.00 PROGRAM $45,200.00.. $49,000.00 PROF SRVCS.. $40,900.00 $49,300.00 WESTERN average ------------------------------------------ $31,900.00 $50,308.75 $46,358.33 $50,675.00 $54,274.33 $53,661.11 $42,900.00 $45,700.00 $45,575.00 $47,500.00 $45,900.00 $46,385.71 15

16 16 Dates, Times, and what you can do with them

17 Dates  Types of Dates  Legacy format (A,I, Z, P format)  Not really a date, but a number or character string which is INTERPRETED as such  I8YYMD, P6MDY, etc.  Smart Date format  Stored as an 'offset' of days, months or year from a base date  Can change output format by a re-definition  Date-Time format  Stored as an offset from a base date  Can go down to micro-seconds (precision controls length)  All need UWS to manipulate components 17

18 Dates : Legacy Dates  USAGE contains Y (or YY), M, and D after format/length  2 places per letter (I8YYMD – good, I6YYMD – bad)  A sequence of digits or characters to be interpreted as a date  No validation  '123456' as 'A6YMD' displays '12/34/56' (delimiter always '/')  FORMAT date components are like EDIT options – only affect display  Only 'T' (month translate) format component even looks at data - Translates month to 3 character abbreviation  As an ACTUAL, can convert directly to a 'smart date' USAGE  Sorted as 'native format' value  For example, I6MDY displays all 'January' values first  Pre 'Y2K', where the century digits were 'assumed' to be '19'  Alpha, packed or zoned – saved on disk storage 18

19 Dates : Smart Dates  USAGE contains ONLY 'date' indicators, no length or data type  Internally stored as an offset from the 'base date'  January 1, 1901 was day 1  May omit day, or month and day  ALWAYS a valid date  Format controls display component order  Can be changed at will - YYMD can be changed to MDYY  Always sorted chronologically (offset sequence)  Century implicit in offset (DEFCENT and USERTHRESH)  Delimited can be '/' (default), '.' (Y.M), '-' (Y-M), ' ' (YBM), or eliminated (Y|M)  May use Q (quarter), JUL (Julian format), or W (day of week)  Can translate M with 'T', 't', 'TR' or 'tr'; W with 'R' or 'r' 19

20 Dates : Date – Time Dates  USAGE begins with 'H' (indicates 'Hour' format)  Stored as offset, including DATE and TIME  Time can be to milliseconds or microseconds  Storage depends of precision (8, 10 or 12 bytes)  Milliseconds = 8 bytes, Microseconds = 10 bytes  Multitude of EDIT options  Leading zero suppression/omission  AM/PM  Upper/lower case  24 hour display  Comma or blank separation  Comparable to SQL date-time formats  UWS begin with 'H' (HADD, HDIFF, etc.) 20

21 Dates: Useful SETs  ALLOWCVTERR – controls display of invalid date conversion  OFFgenerates a diagnostic  ONdisplays invalid date  DTSTRICT – enforces validity of date-time inputs  ONreturn 0 if invalid  OFFonly check range of values  WEEKFIRST – (1 – 7) specifies first day of the week (1=Sunday, 7=Saturday) or (ISO1 – ISO7 : 1 st week with 4 or more days)  BUSDAYS – string indicating working days (i.e. _MTWTF_)  HDAY – part of the name of a holiday file (HDAYxxxx)  Dates in YYMD format  DATEDISPLAY – display the base date as 12/31/1900 or ' ' (OFF)  DEFCENT/YRTHRESH – set first year of 100 year range (19/00)  DATEFORMAT – default order of date components (MDY) 21

22 Dates: Useful Functions  DT() used to set a date-time field to a value  Required for COMPUTE/DEFINE and WHERE  Not needed for IF conditions  FPRINT(infield, 'usageformat', outfield)  Converts ANY format (including date and date-time) to alpha  Replaces FTOA and PTOA  HDATE(value,'YYMD'|outfield)  Convert a date-time to date format  HDIFF(end_value, start_value,'component',outfield)  Find the number of units between 2 date-times  HGETC(length,outfield)  Get the current date-time 22

23 Dates: Useful Functions  HINPUT(in_length,'input_string', length,outfield)  Convert an alpha string to a date-time value  HMASK(source,'component_string', input, length,outfield)  Move multiple date-time components to a target date-time  HNAME/HPART(value,'component', outfield)  Retrieve a date-time component in alpha/numeric format  DATECVT(date,'infmt,'outfmt')  Convert a date/legacy format to date/legacy format  DATEDIF(from_date, to_date,'unit')  Finding the difference between 2 dates  DATMOV(date,'move_point')  Move a date to a significant point 23

24 Dates: Useful Functions  DATETRAN(indate,'(intype)','(fmt_opts)','lang',outlen,output)  Format dates in international formats  AYM/AYMD(indate,increment,outfield)  Add months or days to a legacy date  CHGDAT('infmt','outfmt', legacy_date,outfield)  Change the display of a legacy date  DOWK/DOWKL(indate,outfield)  Find the day of the week  GREGDT/JULDAT(indate,outfield)  Convert between Gregorian and Julian format 24

25 Dates and Dialogue Manager  Dialogue Manager only knows ALPHA strings  No format allowed  Converts 'numeric' strings to numeric when used  Routines expecting non-alpha format (date or date-time)  Pass values in as ALPHA, convert in the call to the routine  Routines produce non-alpha formats  Convert result BEORE passing back to D.M.  BAD example: -SET &FRDT = 20120101; -SET &TODT = 20130101; -SET &DIFF = DATEDIF(&FRDT, &TODT,'M'); -TYPE FROM &FRDT TO &TODT IS &DIFF MTHS FROM 20120101 TO 20130101 IS 328 MTHS 25

26 Dates and Dialogue Manager  BETTER example: -SET &FRDT = 20120101; -SET &TODT = 20130101; -SET &DIFF = DATEDIF( -DATECVT(&FRDT,'I8YYMD','YYMD'), -DATECVT(&TODT,'I8YYMD','YYMD'), - 'M'); -TYPE FROM &FRDT TO &TODT IS &DIFF MTHS FROM 20120101 TO 20130101 IS 12 MTHS 26

27 Dates and Dialogue Manager  DEFINE FUNCTION (thanks to Francis Mariani) DEFINE FUNCTION DIFF (FR/I8, TO/I8) FROM/YYMD = DATECVT(FR,'I8YYMD','YYMD'); TO/YYMD = DATECVT(TO,'I8YYMD','YYMD'); IDIFF/I2 = DATEDIF(FROM,TO,'M'); DIFF/A2 = EDIT(IDIFF); END -RUN -SET &FRDT = 20120101; -SET &TODT = 20130101; -SET &DIFF = DIFF(&FRDT, &TODT); -TYPE FROM &FRDT TO &TODT IS &DIFF MTHS FROM 20120101 TO 20130101 IS 12 MTHS 27

28 HDAY  Used by DATEDIF, DATEMOV, DATECVT and DATEADD  Specifies holidays  Example of HDAY file 20120102 20120116 20120220 20120528 20120704 20120903 20121008 20121122 20121123 20121225 28

29 HDAY Example: SET HDAY=IBI DEFINE FILE CAR HDATE1/HYYMDS = DT(20120101 12:00:00); HDATE2/HYYMDS = DT(20120430 12:00:00); DATE1/YYMD = '20120101'; DATE2/YYMD = '20120430'; DAYS/I5 = DATEDIF(DATE1,DATE2,'D'); WDAYS/I5 = DATEDIF(DATE1,DATE2,'WD'); BDAYS/I5 = DATEDIF(DATE1,DATE2,'BD'); END TABLE FILE CAR PRINT DAYS WDAYS BDAYS HDAYS WHERE COUNTRY EQ 'ENGLAND' END DAYS WDAYS BDAYS ---- ----- ----- 120 85 82 29

30 Tips from Focal Point posts  Parameter Date Print By Warren Hinchliffe, Link Market Services Parameter Date Print  Truncating Text in the Heading of a PDF Document By Warren Hinchliffe, Link Market Services Truncating Text in the Heading of a PDF Document  Simplifying the use of Date functions in Dialogue Manager By Francis Mariani Simplifying the use of Date functions in Dialogue Manager  Open Drilldown in a New Tab By Marilyn Patchen Beyer, Minnesota Department of Education Open Drilldown in a New Tab  Dashboard HTML Page, Output Block, Multiple Selections - how to do?, By Todd Wallace, Milacron llc Dashboard HTML Page, Output Block, Multiple Selections - how to do?  Adding a Conditional Join to a Reporting Object, By Todd Wallace, Milacron llc Adding a Conditional Join to a Reporting Object  Embedded Images in Excel By Warren Hinchliffe, Link Market Services Embedded Images in Excel  For more tips and techniques, check our website http://www.informationbuilders.com/support/developers 30


Download ppt "Noreen Redden FOCUS Users of New England 2012 FOCWizards and Focal Point Information Builders Off to See the Wizards 1."

Similar presentations


Ads by Google