740 likes | 1.15k Views
More Things You Can Use on Monday. Walter F. Blood Technical Director . More Things You Can Use on Monday. Agenda SET Parameters Reporting Dialogue Manager Functions Troubleshooting My Top 5 from Last Year. SET Parameters. SET Parameters. A few more of my favourite SET parameters
E N D
More Things You Can Use on Monday Walter F. Blood Technical Director
More Things You Can Use on Monday Agenda • SET Parameters • Reporting • Dialogue Manager • Functions • Troubleshooting • My Top 5 from Last Year
SET Parameters • A few more of my favourite SET parameters • ACROSSLINE • EMPTYCELLS • EMPTYREPORT • FILECOMPRESS • FOCFIRSTPAGE • CNOTATION • OVERFLOWCHAR • HIDENULLACRS • Working with SET Parameters
SET Parameters – ACROSSLINE • Controls the display the default line across the report • Options: ON, OFF, SKIP • Default: ON SET ACROSSLINE = ON SET ACROSSLINE = OFF
SET Parameters – ACROSSLINE • Controls the display the default line across the report • Options: ON, OFF, SKIP • Default: ON SET ACROSSLINE = SKIP TITLELINEis a synonym forACROSSLINE
SET Parameters – EMPTYCELLS • Controls the content of null cells in Excel output • Options: ON, OFF • Default: ON SET EMPTYCELLS = ON SET EMPTYCELLS = OFF
SET Parameters – EMPTYCELLS • Works in conjunction with NODATA SET EMPTYCELLS = OFF SET NODATA = 'No Data'
SET Parameters – EMPTYREPORT • Controls what is displayed if no data returned • Options: ON, OFF, ANSI • Default: OFF SET EMPTYREPORT = OFF SET EMPTYREPORT = ON SET EMPTYREPORT = ANSI
SET Parameters – FILECOMPRESS • Enables the compression of PDF report output • Options: ON, OFF • Default: OFF SET FILECOMPRESS = OFF SET FILECOMPRESS = ON 1.1 MB 244 KB
SET Parameters – FOCFIRSTPAGE • Controls the first page number of a report • Options: n • Default: 1 SET FOCFIRSTPAGE = 1 SET FOCFIRSTPAGE = 5
SET Parameters – FOCFIRSTPAGE • &FOCNEXTPAGE will tell you what the next page number will be after a report runs • Use with FOCFIRSTPAGE SET FOCFIRSTPAGE = &FOCNEXTPAGE &FOCNEXTPAGE = 5
SET Parameters – CNOTATION • Controls how columns are numbered for internal referencing during report processing • Options: ALL, PRINTONLY, EXPLICIT • Default: ALL TABLE FILE GGSALES SUM DOLLARS NOPRINT COMPUTE VARIANCE/D12M = DOLLARS - BUDDOLLARS; BY REGION END
SET Parameters – CNOTATION TABLE FILE GGSALES SUM DOLLARS NOPRINT COMPUTE VARIANCE/D12M = DOLLARS - BUDDOLLARS; BY REGION END SET CNOTATION = ALL SET CNOTATION = PRINTONLY SET CNOTATION = EXPLICIT
SET Parameters – OVERFLOWCHAR • Controls the character displayed on an overflow • Options: *, any character • Default: * OVERFLOWCHAR = * OVERFLOWCHAR = !
SET Parameters – HIDENULLACRS • Suppresses printing of null across columns on a page • Options: ON, OFF • Default: OFF SET HIDENULLACRS= OFF SET HIDENULLACRS= ON
SET Parameters – Working with parameters • SET parameter values can be displayed ? SET ? SET ALL ? SET ACROSSLINE
SET Parameters – Working with parameters • SET parameter categories can be displayed ? SET CATEGORY REPORT ? SET CATEGORY DATES
SET Parameters – Working with parameters • SET parameters can be displayed by category Categories MEMORY DATES SECURITY SINK SEND COMPUTATION MDI EXTERNALSORT FOCCALC ENVIRONMENT WEBFOCUS REPORT GRAPH STYLESHEET RETRIEVAL HOLD PLATFORM MAINFRAME ? SET BY CATEGORY
SET Parameters – Working with parameters • SET parameter values can be explained ? SET FOR ACROSSLINE
SET Parameters – Working with parameters • SET parameter values can be captured • SET parameter values can be used -? SET ACROSSLINE &SETTING &SETTING = ON -? SET ACROSSLINE &SETTING -IF &SETTING EQ 'ON' THEN GOTO …
Reporting – DEFINE Functions • Subroutines based on WebFOCUS DEFINEs • Take arguments and return results • Can be used with any data file • As a compute, serves a very specific purpose • How do we make it more useable? COMPUTE DOLPERUNIT/D12.2 = DOLLARS / UNITS;
Reporting – DEFINE Functions • Create a DEFINE function • Use the function in the COMPUTE DEFINE FUNCTION PERUNIT (VALUE/D12, QTY/I9) PERUNIT/D12.2 = VALUE / QTY ; END COMPUTE DOLPERUNIT/D12.2=PERUNIT(DOLLARS,UNITS);
Reporting – DEFINE Functions • Creates a reusable and consistent function COMPUTE DOLPERUNIT/D12.2 = PERUNIT(DOLLARS,UNITS); COMPUTE BUDPERUNIT/D12.2 = PERUNIT(BUDDOLLARS,BUDUNITS);
Reporting – DEFINE Functions • Syntax DEFINE FUNCTION name (arg1/fmt1,..., argn/fmtn) [tempvariablea/formata = expressiona;] . . . [tempvariablex/formatx = expressionx;] name/format = [result_expression]; END
Reporting – DEFINE Functions • Usage Notes • The number of functions you can define and use in a session is virtually unlimited • Only cleared by DEFINE FUNCTION CLEAR command • Function names can be up to 64 characters. • Argument names are limited to 12 characters • No limit to the number of arguments • Can call other DEFINE functions, but cannot call themselves • If a DEFINE function isn’t available • (FOC03665) Error loading external function '%1'
Reporting – FILTER FILE • Automatic filtering in reports and graphs • Can be activated and deactivated as required Define the Filter FILTER FILE GGSALES NAME = MIDWEST WHERE REGION EQ 'Midwest'; END Activate the Filter SET FILTER = MIDWEST IN GGSALES ON
Reporting – FILTER FILE FILTER FILE GGSALES NAME = MIDWEST WHERE REGION EQ 'Midwest'; END TABLE FILE GGSALES SUM DOLLARS UNITS BY REGION END SET FILTER = MIDWEST IN GGSALES OFF SET FILTER = MIDWEST IN GGSALES ON
Reporting – FILTER FILE SET FILTER = FILTER FILE GGSALES NAME = MIDWEST WHERE REGION EQ 'Midwest'; NAME = NTHEAST WHERE REGION EQ 'Northeast'; NAME = STHEAST WHERE REGION EQ 'Southeast'; NAME = WEST WHERE REGION EQ 'West'; END MIDWEST IN GGSALES ON NTHEAST IN GGSALES ON STHEAST IN GGSALES ON WEST IN GGSALES ON
Reporting – FILTER FILE FILTER FILE GGSALES NAME = MIDWEST WHERE REGION EQ 'Midwest'; NAME = COFFEE WHERE PRODUCT CONTAINS 'Coffee'; END SET FILTER = MIDWEST COFFEE IN GGSALES ON
Reporting – FILTER FILE • Once activated, will apply to all subsequent reports • Apply variable selections passed in from forms • Enforce row level security • Avoid Dialogue Manager code inside a TABLE FILE -DEFAULT &SETFILTER=OFF SET FILTER = MIDWEST IN GGSALES &SETFILTER TABLE FILE GGSALES SUM DOLLARS UNITS BY REGION BY PRODUCT END TABLE FILE GGSALES SUM DOLLARS UNITS BY REGION BY PRODUCT -IF &SETFILTER EQ 'OFF' THEN - GOTO NO_FILTER; WHERE REGION EQ 'Midwest'; -NO_FILTER END VS
Reporting – Hold Files • ON TABLE HOLD directly to an app folder • HOLD AS app/filename • Puts summit.ftm into the baseapp app folder • To capture summit.mas still needs APP HOLDMETA TABLE FILE GGSALES SUM DOLLARS BY REGION ON TABLE HOLD AS baseapp/summit.ftm END
Reporting – Hold File Delimiter • Select any character as your column delimiter ON TABLE HOLD AS HDATA FORMAT DFIX DELIMITER '~' Midwest~11400665 Northeast~11392300 Southeast~11710379 West~11652946 SEGNAME=HDATA, DELIMITER=~, HEADER=NO, $ ON TABLE HOLD AS HDATA FORMAT DFIX DELIMITER '~' HEADER YES Region~Dollar Sales Midwest~11400665 Northeast~11392300 Southeast~11710379 West~11652946 SEGNAME=HDATA, DELIMITER=~, HEADER=YES, $
Dialogue Manager – Testing for Operating System • &FOCMODE • Returns the operating system you are running in • Enables you to take action based on where you are • Values: WINNT, UNIX, etc. -IF &FOCMODE EQ 'UNIX' THEN GOTO UNIX_STUFF - ELSE GOTO WIN_STUFF;
Dialogue Manager – .EXISTS • Indicates if an & variable exists (has value) • Can be used to control navigation • 0 = variable does not exist • 1 = variable exists -IF ®ION.EXIST EQ 0 THEN GOTO GET_REGION - ELSE GOTO RUN_REPORT;
Dialogue Manager – .EVAL • Resolves & variables in a pre-parse of Dialogue Manager • Enables resolved variables to be used in DM code -SET ®ION = 'West'; -SET &TITLE = 'Report for ®ION'; -SET ®ION = 'West'; -SET &TITLE = 'Report for ®ION.EVAL';
Dialogue Manager – .QUOTEDSTRING • Automatically and intelligently puts quotes around & variables TABLE FILE EMPDATE PRINT NAME IF NAME EQ &NAME END TABLE FILE EMPDATE PRINT NAME IF NAME EQ &NAME.QUOTEDSTRING END &NAME = John Smith &NAME = John O’Brian
Dialogue Manager – .LENGTH • Returns the length of an & variable value • Can be used for edit checking and to control navigation -SET ®ION = 'West'; -SET ®ION = 'West '; ®ION.LENGTH = 4 ®ION.LENGTH = 10 -SET ®ION = 'West '; -SET ®ION = TRUNCATE(®ION); ®ION.LENGTH = 4 -IF ®ION.LENGTH LT 10 THEN GOTO SHORT_REGION - ELSE GOTO LONG_REGION;
Dialogue Manager – .TYPE • Returns the type of an & variable value • Can be used for edit checking and to control navigation • A = alphanumeric • N = numeric -SET ®ION = 'West'; -SET ®ION = '12345'; ®ION.TYPE = A ®ION.TYPE = N -IF ®ION.TYPE EQ A THEN GOTO ALPHA_REGION - ELSE GOTO NUM_REGION;
Dialogue Manager – DEFAULTH • Sets a default value for hidden & variables • Hidden & variables are not prompted for • Autoprompt, MR Publish Utility, HTML Composer, ReportCaster Scheduling -DEFAULT &ORDERDATE=19970101 -DEFAULTH &ORDERDATE=19970101
Functions • A few more of my favourite functions • UPCASE • LOCASE • LCWORD • FPRINT
Functions – UPCASE • Convert a string to upper case • UPCASE(length, input, outfield) UP_REGION/A11=UPCASE(11,REGION,UP_REGION);
Functions – LOCASE • Convert a string to lower case • LOCASE(length, input, outfield) LO_REGION/A11=LOCASE(11,REGION,UP_REGION);
Functions – LCWORD • Convert a string to lower case • LCWORD(length, string, outfield) MX_COUNTRY/A10=LCWORD(10, COUNTRY, MX_COUNTRY);
Functions – FPRINT • Convert any numeric data to the alpha display you want • FPRINT(infield, format, outfield) ADOLLARS/A20= FPRINT(DOLLARS,'D12M',ADOLLARS); SALES/A30= 'Sales = ' | ADOLLARS;
SQL Tracing - TRACESTAMP • Controls the display of the time stamp on SQL trace • Options: ON, OFF • Default: ON SET TRACESTAMP = ON SET TRACESTAMP = OFF SET TRACESTAMP=OFF SET TRACEOFF=ALL SET TRACEON=SQLAGGR//CLIENT SET TRACEON=STMTRACE//CLIENT SET TRACEUSER=CLIENT