noreen redden focus users of new england 2012 focwizards and focal point information builders off to...

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

Upload: ferdinand-johnson

Post on 28-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

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

Noreen ReddenFOCUS Users of New England 2012

FOCWizards and Focal Point

Information Builders

Off to See the Wizards

1

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

Techniques – Of Course

2

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

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.

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

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 reports3. Use DEFINE to specify parameters for each section.

Sales Record

counter

Sale #1REGION

X

Copy 1 Copy 2

Sale #2REGION

Y

Copy 1 Copy 2

DEFINESRT

REGION X REGION YTOTAL TOTAL

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

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

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

McGyver

6

SET HIDENULLACRS = ONTABLE FILE EMPDATASUM SALARY ACROSS CLASS AS 'Job Class'BY ORDER NOPRINT PAGE-BREAKBY SRT NOPRINT PAGE-BREAKBY DEPTIF ORDER EQ 1 OR 2HEADING"Salaries For Area: <SRT "WHEN ORDER EQ 1;HEADING"Salaries For All Areas "WHEN ORDER EQ 2; END

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

                                                          Salaries For Area:  NORTH EASTERN

Job Class019 257 389

DEPT

CUSTOMER SUPPORT $62,500.00 . $19,300.00MARKETING . $139,800.00 .SALES . $82,600.00 .

Salaries For Area:  SOUTH EASTERNJob Class019 064 229

DEPT

CONSULTING . $85,400.00 .CUSTOMER SUPPORT $62,500.00 . .MARKETING . . .PERSONNEL $80,500.00 . .PROGRAMMING & DVLPMT . . $49,000.00

McGyver

7

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

                                                          Salaries For All Areas

Job Class019 064 229

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.00SALES $239,100.00 . .

McGyver

8

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

  

Job Class

257 389

. $58,800.00

. $56,200.00

. .

. $19,300.00

$508,200.00 .

. $91,300.00

. .

$156,100.00 .

McGyver

9

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

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 TOTALAs it is Built key rec1comment key rec1comment rec2comment key rec1comment rec2comment rec3comment* After SUM or WHERE TOTAL key rec1comment rec2comment rec3comment

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

Combining

11

SET CNOTATION = EXPLICITSET DROPBLNKLINE = ONDEFINE FILE EMPDATACNTIT/I1 WITH PIN = 1;ENDTABLE FILE EMPDATAPRINT 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'; NOPRINTBY AREA NOPRINT SUBHEAD"Employees for Area <AREA "WHERE TOTAL FLAG EQ 'Y'END

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

  

Employees for Area CENTRAL

000000040 000000050 000000180 000000200 000000240 000000250

000000290 000000360 000000390

Employees for Area CORPORATE

000000010 000000070 000000100 000000130 000000300 000000320

000000400

Employees for Area NORTH EASTERN

000000060 000000110 000000140 000000190 000000210 000000310

Employees for Area SOUTH EASTERN

000000020 000000120 000000160 000000220 000000230 000000280

Employees for Area WESTERN

000000030 000000080 000000090 000000150 000000170 000000270

000000340 000000350

Combining

12

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

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

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

Averages

Example Using ACROSS

TABLE FILE EMPDATASUM CNT.SALARY NOPRINT SALARY NOPRINTCOMPUTE AVE1/D8.2M = SALARY/CNT.SALARY ; AS ''

ACROSS BLANK NOPRINTACROSS AREABY TYPDEP/RROWS 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

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

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

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

16

Dates, Times, and what you can do with them

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

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

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

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 storage18

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

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 MDYYAlways 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

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

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 formatsUWS begin with 'H' (HADD, HDIFF, etc.)

20

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

Dates: Useful SETs

ALLOWCVTERR – controls display of invalid date conversionOFF generates a diagnostic ON displays invalid date

DTSTRICT – enforces validity of date-time inputsON return 0 if invalid OFF only check range of values

WEEKFIRST – (1 – 7) specifies first day of the week (1=Sunday, 7=Saturday) or (ISO1 – ISO7 : 1st 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 formatDATEDISPLAY – 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

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

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

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

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

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

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

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

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

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

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

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

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

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

HDAY

Used by DATEDIF, DATEMOV, DATECVT and DATEADD Specifies holidays

Example of HDAY file

20120102201201162012022020120528201207042012090320121008201211222012112320121225

28

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

HDAY

Example:SET HDAY=IBIDEFINE FILE CARHDATE1/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

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

Tips from Focal Point posts

Parameter Date Print By Warren Hinchliffe, Link Market Services Truncating Text in the Heading of a PDF Document By Warren Hinchliffe, Link

Market Services Simplifying the use of Date functions in Dialogue Manager By Francis Mariani Open Drilldown in a New Tab By Marilyn Patchen Beyer, Minnesota Department

of Education Dashboard HTML Page, Output Block, Multiple Selections - how to do?, By Todd

Wallace, Milacron llc Adding a Conditional Join to a Reporting Object, By Todd Wallace, Milacron llc Embedded Images in Excel By Warren Hinchliffe, Link Market Services

For more tips and techniques, check our websitehttp://www.informationbuilders.com/support/developers

30