64
Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011, Information Builders. Slide 1

Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Embed Size (px)

Citation preview

Page 1: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Branching Techniques for Managing WebFOCUS Applications

Joel StarkmanDirector, FOCUS DivisionInformation Builders, Inc.

October, 2011

Copyright 2011, Information Builders. Slide 1

Page 2: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Managing Flow

A procedure can be navigated by:

Unconditional branching ( ) – transfer control to a label

Conditional branching ( ) – transfer control to a label depending on the outcome of a test

Looping – perform a set of commands repeatedly

Page 3: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

‑label [TYPE text]‑label [TYPE text]

Branching to a Label

The –label command creates a physical reference point in the code as a target of a –GOTO or –IF statement

user‑defined name, up to 64 characters. No blanks, nor the name of any Dialogue Manager command except ‑QUIT or ‑EXIT

Optional – sends a message to the client

Page 4: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Unconditional Branching

An “unconditional branch” via –GOTO always transfers control to the specified label

.

.

.-GOTO label.. (any executable code). (any Dialogue Manager code).-label [TYPE text].. .

Page 5: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Unconditional BranchingExample

Skip over the TABLE request by

jumping to the –SKIPOVER label

-GOTO SKIPOVERTABLE FILE SALESPRINT UNIT_SOLD RETURNSBY PROD_CODE BY CITYEND ‑RUN ‑SKIPOVER‑TYPE Skipped over the report

Page 6: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Plant Sales Report

Management would like us to modify a report that currently allows an analyst to select the plant and a specific year.

The modified report should display all years for specific plant in a sales summary report sorted by product.

Before: After:

Page 7: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

The WebFOCUS Auto Prompting facility opens

Page 8: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Activate the Unconditional Branching

Change the source code:

Page 9: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Activate the Unconditional Branching

Change the source code:

Page 10: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

Page 11: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

View the DM and FOCUS Commands

View the effect of the –SET &ECHO=ALL; command

Page 12: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

View the DM and FOCUS Commands

skipped

Page 13: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Conditional Branching

expression any valid expression on which to make the decision

label1passes control to label1 when expression is true (THEN is optional)

CONTINUE drops to the command after the ending semicolon (;)

ELSE GOTO label2 passes control to label2 when expression is false

ELSE IF/THEN/ELSE compound ‑IF inside the outer ‑IF (with its own labels)

-IF expression [THEN] GOTO label1|CONTINUE - [ELSE IF/THEN/ELSE[;]] - [ELSE GOTO label2|CONTINUE];

-IF expression [THEN] GOTO label1|CONTINUE - [ELSE IF/THEN/ELSE[;]] - [ELSE GOTO label2|CONTINUE];

Conditional branching transfers control to one of several labels, based on the evaluation of an expression

Page 14: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Conditional Branching Example

‑IF &OPTION EQ 'S' GOTO PRODSALES;‑PRODRETURNSTABLE FILE SALESPRINT PROD_CODE UNIT_SOLDBY STORE_CODEEND‑EXIT‑PRODSALESTABLE FILE SALESSUM UNIT_SOLDBY PROD_CODEEND

Pass control to ‑PRODSALES if &OPTION equals ‘S’ ,

otherwise pass control to the next line

Not needed inthis simple case

Page 15: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Compound –IFExample

‑IF &OPTION EQ 'R' THEN GOTO PRODRETURNS ELSE

‑ IF (&OPTION EQ 'S') GOTO PRODSALES ELSE‑ GOTO QUIT;‑*‑PRODRETURNSTABLE FILE SALESPRINT PROD_CODE UNIT_CODEBY STORE_CODEEND‑GOTO QUIT‑PRODSALESTABLE FILE SALESSUM UNIT_SOLDBY PROD_CODEEND‑QUIT

Page 16: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Compound IF Alternative Syntax

The previous nested –IF expression:

‑IF &OPTION EQ 'R' THEN GOTO PRODRETURNS ELSE ‑ IF (&OPTION EQ 'S') GOTO PRODSALES ELSE‑ GOTO QUIT;

may be written as separate expressions (clearer?):

‑IF &OPTION EQ 'R' THEN GOTO PRODRETURNS; ‑IF &OPTION EQ 'S' THEN GOTO PRODSALES;‑GOTO QUIT

Semicolons endeach statementSemicolons endeach statement

Page 17: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Branch Report

Constance Paine needs our help in fixing a procedure that should allow an analyst to choose between summing sales by Store Name or by Region.

Page 18: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Open the Procedure

Code targets for Dialogue Manager additions

Page 19: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Using GUI Tools for adding DM

GUI tools for adding Dialogue Manager Commands

Page 20: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Adding Conditional Branching

The Dialogue Manager -IF wizard

Page 21: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Adding Conditional Branching

The Dialogue Manager -IF wizard

Page 22: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Adding a Label

Add a Dialogue Manager Label

Page 23: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Adding Unconditional Branching

Add a -GOTO

Page 24: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Verify Your Work

The Logical View

Page 25: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Plant Sales Report

Management would like a report that allows an analyst to select the plant and either a specific year or all years for a sales summary report sorted by product.

Page 26: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

Need to add the ‘ALL’ option

Page 27: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Add the Conditional Branching

Add the ALL option to &YEAR

Page 28: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Activate the Conditional Branching

Activate the conditional branching statements

Page 29: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Activate Conditional Branching

Add the –SET command and the page heading reference

Page 30: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

The page heading text reflects your changes

Page 31: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Change the Selection Criteria

There were zero records for the Boston plant in 1999

You never want to see this error

Page 32: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Activate the Error Message

Activate the Dialogue Manager commands

&LINESreserved &variable

(one of many)Contains number of output lines

in the previous TABLE

&LINESreserved &variable

(one of many)Contains number of output lines

in the previous TABLE

-INCLUDEInserts code from errorout.fex

and executes it as if it wasactually coded here

-INCLUDEInserts code from errorout.fex

and executes it as if it wasactually coded here

Page 33: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Open the Procedure

The ERROROUT procedure contains HTML statements bracketed by –HTMLFORM BEGIN and –HTMLFORM END

Page 34: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

WebFOCUS now displays an error message

That’s better!

might want to useSET EMPTYREPORT=ON

instead of a message

Page 35: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping with -REPEAT

Copyright 200B, Information Builders. Slide 35

Page 36: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping

A series of commands can be performed repeatedly by using looping with the ‑REPEAT command

-REPEAT has three variations:

• For a specific number of times

• While a condition is true

• For a calculated number of times

(with a referenceable counter)

Page 37: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

LoopingAlternate Loop Control

–REPEAT is a convenient substitute for using a –SET with a variable that acts like a counter to control a loop

Example:

-SET &N=0‑START‑SET &N=&N+1;–TYPE REPETITION &N‑IF &N GT 5 GOTO NOMORE;‑GOTO START‑NOMORE TYPE EXCEEDED REPETITION LIMIT‑EXIT

Could be written in one line:‑IF &N LE 5 GOTO START;

Page 38: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping a Specific Number of Times

‑REPEAT label n TIMES‑REPEAT label n TIMES

end-of-loop marker

the number of times

to execute the loop

Page 39: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping a Specific Number of Times

For example:

‑REPEAT LAB1 2 TIMES‑TYPE INSIDE LOOP‑LAB1 -TYPE OUTSIDE LOOP

The output is:

INSIDE LOOPINSIDE LOOPOUTSIDE LOOP

Page 40: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping While a Condition is True

‑REPEAT label WHILE condition‑REPEAT label WHILE condition

end-of-loop marker

condition under which to

re-execute the loop each time

Page 41: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping While a Condition is TrueExample

-SET &INPUT = ‘ ‘;-SET &GOT_ONE = 0;-SET &A = 0;‑REPEAT LABEL WHILE &GOT_ONE EQ 0-SET &A = &A + 1;‑TYPE LOOP &A‑READ fromfile &INPUT.10.-SET &GOT_ONE = &IORETURN;‑LABEL -SET &A = &A – 1;-TYPE GOT &A RECORDS

‑REPEAT label WHILE condition‑REPEAT label WHILE condition

For a 2-record file, the output shows:

LOOP 1LOOP 2LOOP 3GOT 2 RECORDS

Another reservedsystem & variables

Page 42: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping a Calculated Number of Times

‑REPEAT label FOR &variable [FROM fromval] [TO toval] [STEP s]

‑REPEAT label FOR &variable [FROM fromval] [TO toval] [STEP s]

end-of-loopmarker

Loop counter, tested at start of each execution of the loop

start value of &variable (default is 1) end value of &variable

(default is 1,000,000)

increments &variable by a constant ‘s’. may be positive or negative; default increment is 1

Page 43: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Looping a Calculated Number of TimesExample

‑REPEAT LABEL1 FOR &A FROM 3 TO 7 STEP 2

‑TYPE INSIDE &A‑LABEL1-TYPE OUTSIDE &A

The output is:

INSIDE 3

INSIDE 5

INSIDE 7

OUTSIDE 9

‑REPEAT label FOR &variable [FROM fromval] [TO toval] [STEP s]

‑REPEAT label FOR &variable [FROM fromval] [TO toval] [STEP s]

Page 44: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

LoopingPrematurely Stop a Loop

A loop terminates when:

•it is executed in its entirety

•a –QUIT or –EXIT command is issued

•a –GOTO is issued to a label outside of the loop

-REPEAT LOOP 5 TIMES-TYPE HELLO-GOTO OUTSIDELOOP-LOOP-OUTSIDELOOP-TYPE AFTER LOOP

See:HELLOAFTER LOOP

Page 45: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Product Report

Management would like a report that reads and counts the products captured in an external SAVE file.

Should looklike this

Page 46: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Process

To accomplish this task, follow these steps:

1.Capture the report output in a SAVE file ‘PRODHOLD’

2.Use a procedure called PRODLOOP that:

• loops to read data from the PRODHOLD file

• displays an incremental counter for each record

• displays the total records in the file

Page 47: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The SAVE File

Select PRODHOLD as a SAVE file

Page 48: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

-* File PRODLOOP.FEX-* -SET &ECHO=ALL;-INCLUDE PRODHOLD-RUN-SET &NUMPROD = &LINES;-SET &BLANK = ‘ ‘;-*-TYPE ***********************************-TYPE Total Number of Products - &NUMPROD-TYPE ***********************************-TYPE-*-EXIT-REPEAT LOOP1 FOR &CNTR TO &NUMPROD-SET &PRODCODE = ‘A234’;-SET &PRODNAME = ‘A23456789012345678901234567890’;-READ PRODHOLD &PRODCODE &PRODNAME-IF &IORETURN NE 0 GOTO AFTERLOOP ;-TYPE &CNTR &BLANK &PRODCODE &PRODNAME-LOOP1-AFTERLOOP-EXIT

The PRODLOOP Procedure

Generate the data extract

Capture &LINES from the report

Display # of lines

Repeat &NUMPROD times

Declare length of &var’s

Read a line, 0=got one

reserved &variable

-SET &PRODCODE = ‘ ‘;-SET &PRODNAME = ‘ ‘;-READ PRODHOLD &PRODCODE.4. &PRODNAME.30.

OR

Page 49: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

The report output

Columns are notaligned properly

Page 50: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Edit the Procedure

Change the procedure

-* File PRODLOOP.FEX-* -SET &ECHO=ALL;-INCLUDE PRODHOLD-RUN-SET &NUMPROD = &LINES;-SET &BLANK = ‘ ‘;-*-TYPE ***********************************-TYPE Total Number of Products - &NUMPROD-TYPE ***********************************-TYPE-*-EXIT-REPEAT LOOP1 FOR &CNTR TO &NUMPROD-SET &PRODCODE = ‘A234’;-SET &PRODNAME = ‘A23456789012345678901234567890’;-READ PRODHOLD &PRODCODE &PRODNAME-IF &IORETURN EQ 0 GOTO AFTERLOOP ;-SET &FIRST = IF &CNTR GT 9 THEN ‘&CNTR.EVAL’ ELSE ‘0&CNTR.EVAL’;-TYPE &FIRST &BLANK &PRODCODE &PRODNAME-LOOP1-AFTERLOOP-EXIT

-SET &FIRST = IF &CNTR GT 9THEN ‘&CNTR.EVAL’ELSE ‘0&CNTR.EVAL’;

Page 51: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

The columns have been aligned

Page 52: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Review: Managing Flow

Unconditional branching,transfer control to a label –GOTO label

Conditional branching, transfer control to a label based on a conditional expression

–IF expression GOTO label1 ELSE [IF…] GOTO label2;

Repeat a set of commands,via several looping criteria options -REPEAT label n TIMES

-REPEAT label WHILE cond-REPEAT label FOR &var FROM x TO y STEP z-label

Page 53: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Thank You

Page 54: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Copyright 20011 Information Builders. Slide 54

End of presentationPress esc to exit

Page 55: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Copyright 200B, Information Builders. Slide 55

Conventions Used in this Workshop

Business Situation

Notes

Key

Alert

Summary

Page 56: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The &ECHO Command

&ECHO= FunctionalityON Displays FOCUS commands that are expanded and

stacked for execution.

ALL Displays both Dialogue Manager and FOCUS commands that are expanded and stacked for execution.

OFF Suppresses both Dialogue Manager and FOCUS commands that are expanded and stacked for execution.

NONE Prevents procedure code from being displayed (echoed). Once the value of &ECHO has been set to NONE, it cannot be changed during the session or connection.

{-DEFAULT|‑SET|EX &ECHO = {ON|ALL|OFF|NONE}

Page 57: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The Procedure

 1.The –INCLUDE incorporates the PRODHOLD procedure, which generates the PRODHOLD external file.2.The –SET commands assign values to the variables needed for the report. For example, &NUMPROD, which is based on &LINES (a statistical variable), the total number of output lines generated from the PRODHOLD procedure.3.The –TYPE commands act as a page heading to display the total number of products.

Page 58: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

View the Variables

Add -? &PROD to display the variables that begin with ‘PROD’ and their corresponding values

Page 59: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Termination Commands

Command Description

-EXIT Forces a procedure to end. All stacked commands are executed and the procedure exits.

If the current procedure was called by another procedure, the calling procedure continues processing. Use –EXIT for terminating a procedure after processing a final branch that completes the desired task. The last line of a procedure implies a –EXIT.

–EXIT can also be inserted strategically into procedure by a developer to assist the debugging of a complicated set of instructions.

Page 60: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Termination Commands

Command Description

-QUIT Forces an immediate exit from a procedure. Remnant stacked commands are not executed.

If the current procedure was called by another procedure, control returns directly to the client application, not the calling procedure.

-QUIT can be the target of a branch.

-QUIT FOCUS [n] Where n is the application return code value, which can be a constant or an integer value (the default value is 0).

In Developer Studio, terminates the procedure without executing stacked commands, exits WebFOCUS, and returns to either the calling program or the operating system.

Upon exiting WebFOCUS, the value of the return code is returned to the calling program, if one exists. This can be useful in programming since the value of the status code can be interrogated to indicate the state when WebFOCUS was exited.

-QUIT FOCUS can be the target of a branch.

Page 61: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

The PRODLOOP Procedure (continued)

The –REPEAT command performs a repetitive section of code that begins with –REPEAT and ends with the –LOOP label

The section repeats for &NUMPROD times (in this case, 17)

The –SET commands define the length of the variables

The –READ command reads each line from the PRODHOLD file and the –TYPE displays each line after it has been read

The process repeats at –LOOP1 for &NUMPROD (17) times

Page 62: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Run the Procedure

The page heading reflects the selection for ‘ALL’

INCORRECT

Page 63: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Testing the Attributes of a Variable(existence, type, length, pre-evaluation)

‑IF &name.attribute expression GOTO label...;

property type; one of: .EXIST the presence of a value for a variable .LENGTH the non-blank length of the variable .TYPE the formatting type of the variable (A or I) .EVAL substitute the value of a variable immediately,

then act on the Dialogue Manager command

property type; one of: .EXIST the presence of a value for a variable .LENGTH the non-blank length of the variable .TYPE the formatting type of the variable (A or I) .EVAL substitute the value of a variable immediately,

then act on the Dialogue Manager command

dot is required between &name and attribute

dot is required between &name and attribute

user-suppliedvariable

user-suppliedvariable

Page 64: Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,

Testing the Attributes of a Variable Examples

-IF &OPTION.EXIST GOTO LAB1 ELSE GOTO… ;

-IF &OPTION.LENGTH LE 3 GOTO LAB2 ELSE GOTO…;

-IF &OPTION.TYPE EQ A GOTO LAB3 ELSE GOTO …;

-IF &OPTION.EVAL LT 99 GOTO LAB4 ELSE GOTO …;

Better use for .EVAL-SET &SKIP= IF … THEN ‘-GOTO LAB5’ ELSE ‘-*’;&SKIP&SKIP.EVAL WHY?

ignoredworks