Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Output HEADING using multiple -READs
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Output HEADING using multiple -READs
 Login/Join
 
Platinum Member
posted
I'm creating a report that will run in report caster and email an inline message out based on data from a db2 table.

I need the heading (all that will print on email) to look at a variable to figure out what it should say.

Here is a sample car file of what I need.

I setup &CAR_TYPE in the DEFINE

Problem: When I run this it only using last read to produce report. Run code as is and you will see that all headings say "I am Sedan..." even though this is not true. Uncomment WHERE and run it to see heading change to "I am d Other..).

I need to read it once, produce heading, loop then read next record, produce heading etc. What am I doing wrong? If you view source code, the -READ is working, its just using last read to produce all HEADINGS.


Car code
 -SET &ECHO=ALL;
-*-INCLUDE setpathgm.fex
APP HOLD baseapp
DEFINE FILE CAR
CAR_TYPE/A12=IF BODYTYPE EQ 'SEDAN' THEN 'Y' ELSE 'N';
END

TABLE FILE CAR
PRINT CAR_TYPE   COUNTRY CAR MODEL BODYTYPE  SEATS DEALER_COST RETAIL_COST SALES LENGTH WIDTH HEIGHT WEIGHT WHEELBASE FUEL_CAP BHP RPM MPG ACCEL
BY BODYTYPE NOPRINT
-*WHERE BODYTYPE NE 'SEDAN';
ON TABLE HOLD AS TYPE_CAR FORMAT ALPHA
END
-*-EXIT

-SET &LOOP = 1;

-SET &REXREAD = &RECORDS;
-
-REPEAT TOEND &REXREAD TIMES

-RUN
-READ TYPE_CAR NOCLOSE &CAR_TYPE.A12.;
-RUN

-TYPE &CAR_TYPE

-SET &LOOP = &LOOP + 1;
-TOEND

-*-EXIT

-SET &AGCY_CAPPED_FTM1 = '\ibi\apps\baseapp\' | 'type_car.ftm';

FILEDEF type_car DISK &AGCY_CAPPED_FTM1
TABLE FILE TYPE_CAR
PRINT BODYTYPE
		COUNTRY NOPRINT

        MODEL NOPRINT

        SEATS NOPRINT
BY BODYTYPE    NOPRINT
ON BODYTYPE PAGE-BREAK
ON TABLE SET PAGE-NUM OFF
HEADING
-IF &CAR_TYPE EQ 'N' GOTO RUNOTH;
"I AM Sedan <BODYTYPE <COUNTRY <MODEL <SEATS "
""
-GOTO FINISH;
-RUNOTH
"I AM Other <BODYTYPE <COUNTRY <MODEL <SEATS"
-FINISH

ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
TYPE=SUBHEAD,
     LINE=1,
     FONT='Verdana',
     JUSTIFY=LEFT,
	 SIZE=11,

$
TYPE=SUBHEAD,
     LINE=3,
     FONT='Verdana',
     JUSTIFY=LEFT,
	 SIZE=10,

$
TYPE=SUBHEAD,
     LINE=5,
     FONT='Verdana',
     JUSTIFY=LEFT,
	 COLOR=RED,
	 SIZE=10,

$
TYPE=SUBHEAD,
     LINE=7,
     FONT='Verdana',
     JUSTIFY=CENTER,
	 SIZE=10,
$
TYPE=SUBHEAD,
     LINE=9,
     FONT='Verdana',
     JUSTIFY=CENTER,
	 SIZE=10,

$
TYPE=SUBHEAD,
     LINE=11,
     FONT='Verdana',
     JUSTIFY=LEFT,
	 SIZE=10,

$
TYPE=SUBHEAD,
     LINE=13,
     FONT='Verdana',
     JUSTIFY=LEFT,
	 SIZE=10,
	 COLOR=BLUE,
	 URL=https://pd.txfb-ins.com/webfocus8/approot/sales_mgt/sales_gm_launch.htm,

$
TYPE=DATA,
     WHEN=AGNC_CD LT 0,
	 COLOR=RED,
$
TYPE=TITLE,
     GRID=ON,
$

ENDSTYLE
END


 

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Are you looking for this ?
DEFINE FILE CAR
CAR_TYPE/A1=IF BODYTYPE EQ 'SEDAN' THEN 'Y' ELSE 'N';
END
TABLE FILE CAR
BY BODYTYPE NOPRINT
ON BODYTYPE PAGE-BREAK
BY COUNTRY
BY CAR
BY MODEL
BY SEATS
ON TABLE SET PAGE-NUM OFF

HEADING
"I am Sedan <BODYTYPE"
""
WHEN CAR_TYPE EQ 'Y'

HEADING
"I am Other <BODYTYPE"
WHEN CAR_TYPE EQ 'N'

ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END
-RUN


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2364 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
I guess that would work but I would have to setup multiple headings which seems like a lot of work....

Here is the actual SUBHEAD I am trying to use.
'Y' LE 0
'N' GT 0

"""
"Here is an update or your allowable growth policies remaining as of ""
"Your Agency has reached its cap."
""
-IF &H_CVT EQ 'Y' GOTO RUNLT40H;
"Homeowners: -GOTO CHKMUT;
-RUNLT40H

"Homeowners: No remaining available policies -CHKMUT
""
-IF &M_CVT EQ 'Y' GOTO RUNLT40M;

"Mutual Policies: ""
-GOTO RUNGT40;
-RUNLT40M
"Mutual Policies: No remaining available policies ""
-RUNGT40;
"If you have any questions, contact your Property Underwriter."
""
"Marketing - Growth Management"


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
See if this is better layout.

 "<ASM_NAME"
""
"Here is an update or your allowable growth policies remaining as of <RPT_DT for <AGNC_CD / <CTY_NME_TXT"
""
"Your Agency has reached its cap."
""
-IF &H_CVT EQ 'Y' GOTO RUNLT40H;
"Homeowners: <PCT_HO_POL1 of remaining available policies  <HO_REMN_POL_LMT policies"
-GOTO CHKMUT;
-RUNLT40H
 
"Homeowners: No remaining available policies  <HO_REMN_POL_LMT policies over limit"
-CHKMUT
""
-IF &M_CVT EQ 'Y' GOTO RUNLT40M;

"Mutual Policies: <PCT_MUT_POL1 of remaining available policies  <MUT_REMN_POL_LMT policies"
""
-GOTO RUNGT40;
-RUNLT40M
"Mutual Policies: No remaining available policies  <MUT_REMN_POL_LMT policies over limit"
""
-RUNGT40;
"If you have any questions, contact your Property Underwriter."
""
"Marketing - Growth Management" 


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Why would my option will need more work ?
As far as I can see you will may have few blocks of heading such as below (row combination may be wrong since I don't know how to evaluate the IFs)

HEADING
"<ASM_NAME"
""
"Here is an update or your allowable growth policies remaining as of <RPT_DT for <AGNC_CD / <CTY_NME_TXT"
""
"Your Agency has reached its cap."
""
"Homeowners: No remaining available policies  <HO_REMN_POL_LMT policies over limit"
""
"Mutual Policies: No remaining available policies  <MUT_REMN_POL_LMT policies over limit"
""
"If you have any questions, contact your Property Underwriter."
""
"Marketing - Growth Management" 
WHEN ABC EQ 0

HEADING
"<ASM_NAME"
""
"Here is an update or your allowable growth policies remaining as of <RPT_DT for <AGNC_CD / <CTY_NME_TXT"
""
"Your Agency has reached its cap."
""
"Homeowners: <PCT_HO_POL1 of remaining available policies  <HO_REMN_POL_LMT policies"
""
"Mutual Policies: <PCT_MUT_POL1 of remaining available policies  <MUT_REMN_POL_LMT policies"
""
"If you have any questions, contact your Property Underwriter."
""
"Marketing - Growth Management" 
WHEN ABC NE 0

Why trying to make it complicated when it can be simple ?
Is it really matter if some heading rows are repeated ?
Avoiding the usage of GOTOs make the code easier to read since in case A (WHEN ABC EQ 0) it's the first HEADING block, when it's case B (WHEN ABC NE 0) it's the second HEADING block, …
Is that really matter if you need to create 10 HEADING blocks if it's going to be easier to maintain ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2364 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Ok, so it's not that much more work, I just feel the -READ should do this for me with the GOTO's. I did get it working using your code but I had to use 4 blocks to make sure it checked for all instances. YY NN YN & NY

Thanks
JV


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Edit your first post then add [SOLVED] at the beginning of your subject


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2364 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Well looks like that works when printing a report but it will not work when Report Caster sends out the email. It puts the message for the intended recipient in the body of the message and attaches the others to the message. This will not work, I really need the READ to work unless there is a way to not attach the extra results to the message.

The report caster job bursts on email address
Thanks
JV


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Ok it looks like it was doing that because I was sending all three to one email address. When I sent them to three different addresses as it would in the real world, it seemed to work. Thanks.


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Not sure how to Edit first post, never could figure that out. Sorry.


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 152 | Registered: August 23, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Scroll to your first post then at bottom right there will be an icon that looks like an open folder with a pen eraser, click on that


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2364 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Output HEADING using multiple -READs

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