Question
Can I vary the WHEN-DO statements for a particular report, depending on my need?
Answer
You could also define several terms as WHEN-DO statements that report on averages, totals, maximums, and so forth, and use them in queries to produce different results. You may want to create a dialog that prompts you for a WHEN-DO term and define a list of valid WHEN-DO terms that can be used.
Here is the first sample query again, defined as a dialog, with a variable for the WHEN-DO statement:
=> CREATION PANEL --------------------------------------------------------------------------DQD10 DATAQUERY: EDITOR CURRENT TABLE: ________________________________ ------------------------------------------------------------------------------- NAME: CUSTOMER-RECS__ TYPE: DIALOG STATUS: PRIVATE DESCRIPTION: CUSTOMER REPORT WITH VARIABLE MATH FUNCTIONS_______________ ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+. .. ================================ T O P ===================================== 13 CUST-ADDRESS-2 14 CUST-ID 15 CITY 16 STATE 17 PHONE 18 FROM CAI-ORDERS-REC 19 ORD-ID TERMS SHIP-DT DISCOUNT (ORDER-TOTAL) 20 11?AVG-ORDER =========================== B O T T O M ================================== ------------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> DISPLAY COLUMNS <PF4> DISPLAY KEYS <PF5> DISPLAY ALL <PF6> LIST TABLES <PF7> BACKWARD <PF8> FORWARD <PF9> TEMPLATE <PF10> VALIDATE <PF11> RIGHT/LEFT <PF12> PROCESS MODE
DIALOG Prompt Panel for Example
When you use a variable WHEN-DO statement in a dialog, you make it possible to produce reports containing different mathematical results with the same query. All you do is use the WHEN-DO term you need as a variable.
Here is what the DIALOG prompt panel may look like when it appears after you press <PF3> EXECUTE on the ONLINE EXECUTION panel for the sample dialog.
=> SCROLL VALUES WITH PF7 OR PF8 AND CHANGE THEM IF DESIRED FOR THIS EXECUTION --------------------------------------------------------------------------DQEX0 Describe the kind of report on orders that you want to produce. You can calculate AVERAGES, TOTALS, MINIMUM ORDERS, or a COUNT of orders by selecting the functions you want this dialog to perform. Select the term name for the function you want to perform or press <PF3> CONTINUE to accept the default. AVG-ORDER ------------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> CONTINUE <PF4> NOT USED <PF5> RANGE/LIST <PF6> NOT USED <PF7> BACKWARD <PF8> FORWARD
The LIST prompt panel for this dialog would look like this:
=> --------------------------------------------------------------------------DQEL0 CHOOSE A VALUE FROM THE LIST BELOW VIA CURSOR POSITION AND PRESS <PF2>. PROMPT: Select the term name for the function you want to perform or press <PF3> CONTINUE to accept the default. AVG-ORDER TOT-ORDER MIN-ORDER CNT-ORDER ------------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> NOT USED <PF4> NOT USED <PF5> NOT USED <PF6> NOT USED <PF7> BACKWARD <PF8> FORWARD
For information about defining variables and lists of valid replacements, see Defining the Dialog
|
Copyright © 2014 CA.
All rights reserved.
|
|