IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    [SOLVED]Passing Values from one Procedure to Another
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
I have values that I need to pass from one procedure to another and it's not working correctly. Below is my code.

Baseline Value Procedure
TABLE FILE TESTCOREMEASURES
PRINT
Value
WHERE ComparitorDateID1 EQ 'FY2009';
WHERE Location_Parent_ID_caption EQ 'SystemWide';
WHERE Measure_Name1 EQ 'Composite Quality Index - Heart Attack (AMI)';
WHERE Comparitor_Type_Name1 EQ 'Operational Planning Grid - Baseline';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS BASELINE
END

Target Value Procedure
TABLE FILE TESTCOREMEASURES
PRINT
Value
WHERE ComparitorDateID1 EQ 'FY2009';
WHERE Location_Parent_ID_caption EQ 'SystemWide';
WHERE Measure_Name1 EQ 'Composite Quality Index - Heart Attack (AMI)';
WHERE Comparitor_Type_Name1 EQ 'Operational Planning Grid - Target';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS TARGET
END

I want the 'Value' data from BOTH procedures to display in a third procedure. I cannot get the last procedure to work. Will someone please post code that will work. I've tried -INCLUDE, -READ, and combinations of all sorts of things. HELP!

This message has been edited. Last edited by: Meghan,


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
Silver Member
Posted Hide Post
You can use a MORE statement to concatenate the two table requests.
Look it up in the Developer Studio help.
A MORE statement requires that the two tables be identical.
Each table has to have the same number of columns and the datatypes of the columns should match.
Very similar to a UNION statement in SQL.

  
-* 1st table request we need data from
TABLE FILE CAR
PRINT
     COUNTRY
     CAR
     MODEL
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS TABLE1
END

-* 2nd table request we need data from
TABLE FILE CAR 
PRINT 
     COUNTRY
     CAR
     MODEL 
WHERE COUNTRY EQ 'FRANCE';
ON TABLE HOLD AS TABLE2
END

-* Using MORE statement to concatenate the two tables
TABLE FILE TABLE1
PRINT
     COUNTRY
     CAR
     MODEL
ON TABLE HOLD AS FINAL_TABLE
MORE
FILE TABLE2
END

-* Print the results of our final table
TABLE FILE FINAL_TABLE
PRINT 
     COUNTRY
     CAR
     MODEL
END


------------------------------------
Prod: WebFOCUS 5.33 Windows/MRE/Report Caster
Dev: WebFOCUS 5.33 Windows/MRE/Report Caster
 
Posts: 35 | Registered: February 12, 2008Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
I don't want to concatenate the results of the two tables. Here's a visual example of what I'm looking for.

Table 1 produces:
Value
92

Table 2 procduces:
Value
94

I want Table 3 to display:
Value Value
92 94

I want them side by side in the same row not two data pieces in one column.


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
If you have 3 separate focexecs that run independently, you are going to have to physically save your SAVE files in a permanent location so that can be picked up and -READ in a 3rd program. You would have to filedef baseline.ftm and target.ftm then -READ the contents into amper variables, then use them in a report.

Here is a model for program 3:
APP FI BASELINE DISK your_save_directory/baseline.ftm
APP FI TARGET DISK your_save_directory/target.ftm
-RUN
-READ BASELINE &BASELINE
-READ TARGET &TARGET
DEFINE FILE filename
BASELINE/I2=&BASELINE;
TARGET/I2=⌖
END
TABLE FILE filename
PRINT BASELINE TARGET
BY whatever
END


Ginny
---------------------------------
Prod: WF 7.6.5 with 7.6.6 WFRS; AIX 5.2; WebSphere 6.1.0.15
Dev: WF 7.6.5 with 7.6.6 WFRS; AIX 5.3; WebSphere 6.1.0.15
Primarily self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable
 
Posts: 1524 | Location: BNSF: Fort Worth, TX | Registered: April 05, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Ginny,

I get the following error using your code:
0 ERROR AT OR NEAR LINE 4 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC374) DIALOGUE MGR VARIABLE IS NOT SPECIFIED BEFORE USE IN -READ: -READ
BASELINE &Value

Basically it's quiting at the 'Define'


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Hold rather than Save in the first two procedures; use Match File to merge the two results, and report off the Hold file it produces.


- Jack Gross
WF 7.6.7, Win
 
Posts: 529 | Location: NYC | Registered: January 11, 2005Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
It appears that the data is coming from the same file with the same selections - except that one value is the baseline and the other is the target. You can do this in one pass of the data, in one TABLE request, with no HOLD or SAVE files, MATCH, or -READ. A simple DEFINE will do the trick. Change the WHERE test to include both the Baseline and Target records. Define one value from the database when it matches the selection criteria, or zero if it does not (or blank if the field is alphanumeric). Use SUM MAX. to display the largest value and put both records on the same line.

DEFINE FILE TESTCOREMEASURES
BASELINE/I5=IF Comparitor_Type_Name1 EQ 'Operational Planning Grid - Baseline'
            THEN Value ELSE 0;
TARGET/I5=IF Comparitor_Type_Name1 EQ 'Operational Planning Grid - Target'
            THEN Value ELSE 0;
END
TABLE FILE TESTCOREMEASURES
SUM MAX.BASELINE MAX.TARGET
WHERE ComparitorDateID1 EQ 'FY2009';
WHERE Location_Parent_ID_caption EQ 'SystemWide';
WHERE Measure_Name1 EQ 'Composite Quality Index - Heart Attack (AMI)';
WHERE Comparitor_Type_Name1 EQ 'Operational Planning Grid - Baseline'
                            OR 'Operational Planning Grid - Target';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS BASELINE
END


Robert Freeman

FOCUS for VM 7.6.x
 
Posts: 4 | Registered: November 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Meghan,
When you say:
quote:

I want the 'Value' data from BOTH procedures to display in a third procedure

do you mean that each procedure retrieves only 1 value?
where do you want the values to be displayed? in a heading? as a list?
According to your answers, there will be different solutions.


Daniel
wf 7.6/WinXP/IIS/SSA
www.wrapapp.com
www.srl.co.il

 
Posts: 594 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteEdit or Delete MessageReport This Post
Silver Member
Posted Hide Post
Following j.gross suggestion of using MATCH FILE.

SET ASNAMES = ON

-* 1st table request we need data from
TABLE FILE CAR
PRINT
     COUNTRY AS 'COUNTRY_A'
     CAR     AS 'CAR_A'
     MODEL   AS 'MODEL_A'
     COMPUTE LINK/A4 = 'LINK';
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS TABLE1
END

-* 2ND TABLE REQUEST WE NEED DATA FROM
TABLE FILE CAR 
PRINT 
     COUNTRY AS 'COUNTRY_B'
     CAR     AS 'CAR_B'
     MODEL   AS 'MODEL_B'
     COMPUTE LINK/A4 = 'LINK';
WHERE COUNTRY EQ 'FRANCE';
ON TABLE HOLD AS TABLE2
END


MATCH FILE TABLE1
PRINT
    COUNTRY_A
    CAR_A
    MODEL_A
BY LINK
RUN
FILE TABLE2
PRINT
     COUNTRY_B
     CAR_B
     MODEL_B
BY LINK
AFTER MATCH HOLD AS HOLD1 OLD-OR-NEW
END


TABLE FILE HOLD1
PRINT 
    COUNTRY_A
    CAR_A
    MODEL_A
    COUNTRY_B
    CAR_B
    MODEL_B
END
-EXIT


------------------------------------
Prod: WebFOCUS 5.33 Windows/MRE/Report Caster
Dev: WebFOCUS 5.33 Windows/MRE/Report Caster
 
Posts: 35 | Registered: February 12, 2008Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
I've tried the DEFINE suggested by Robert and the MATCH FILE suggested by j.gross and Mighty Max - both to no avail.

To answer Daniel's questions:
Yes, each procedure only retrieves 1 value - a baseline and a target value coming from the same cube.

I want the values to be displayed in the body of a report. What I'm looking for in my final report is this - the name of my measure, the baseline (from procedure 1), the score for my measure, and the target (from procedure 2). I want the two values to be displayed in 1 line.


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Ginny -

Can you READ a variable with the format D18.2? I think using your suggestion it's actually getting hung up on the READ command.

(FOC299) UNRECOGNIZED FORMAT OF AMPER VARIABLE IN -READ


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
OK...one last message from me. I figured it out. Here's my final code:

BASELINE TABLE
TABLE FILE TESTCOREMEASURES
PRINT
Value AS 'Baseline'
WHERE ComparitorDateID1 EQ 'FY2009';
WHERE Location_Parent_ID_caption EQ 'SystemWide';
WHERE Measure_Name1 EQ 'Composite Quality Index - Heart Attack (AMI)';
WHERE Comparitor_Type_Name1 EQ 'Operational Planning Grid - Baseline';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS 'BASELINE'
END


TARGET TABLE
TABLE FILE TESTCOREMEASURES
PRINT
Value AS 'Target'
WHERE ComparitorDateID1 EQ 'FY2009';
WHERE Location_Parent_ID_caption EQ 'SystemWide';
WHERE Measure_Name1 EQ 'Composite Quality Index - Heart Attack (AMI)';
WHERE Comparitor_Type_Name1 EQ 'Operational Planning Grid - Target';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS 'TARGET'
END


FINAL PROCEDURE
-INCLUDE app/testing_baseline.fex
-INCLUDE app/testing_target.fex
-RUN
-READ BASELINE &Baseline.A18
-READ TARGET &Target.A18
DEFINE FILE TESTCOREMEASURES
Baseline/D18.2=&Baseline;
Target/D18.2=&Target;
END
TABLE FILE TESTCOREMEASURES
PRINT
Baseline
Percent_of_Qualifying_Accounts/D12.2%
Target
BY Measure_Set
WHERE Measure_Set EQ 'Composite Quality Index - Heart Attack (AMI)';
ON TABLE NOTOTAL
END


Where it was getting hung up was on the -READ. I did some searching and you cannot use D18.2 as a format in the READ even if the variable you are trying to READ is a D18.2. I had to trick it by putting it as a A18 and then using the DEFINE to set it right again. Works like a charm. No APP FI necessary.

THANK YOU ALL for your help - couldn't have done it without you.


Prod: WebFOCUS 7.6.6 on Win XP
 
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    [SOLVED]Passing Values from one Procedure to Another

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.