Focal Point
[SOLVED] How to change field values for a report

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9787070595

December 09, 2010, 05:13 PM
Tomsweb
[SOLVED] How to change field values for a report
From a launch page the user selects which &RPTYPE (AGEGRP, COVGRP, ZIP) file is to be
used to create a report.

In the ZIP.ftm there is a field named ZIP.
Possible values for Zip are:

Allegany
Anne Arundel N
_Non_Residential
Wicomico
Worcester

In the AGEGRP.ftm there is a field named AGEGRP.
Possible values for AGEGRP are:
0-<1
1-5
6-14
15-18

In the COVGRP.ftm there is a field named COVGRP
Possible values for COVGRP are:
Aged/Disabled
Families and Children (FAC)
Maryland Children's Health Program (MCHP)
Other
PAC

I am trying to write some (Dialogue Manager
or Define) logic to look at which &RPTYPE the
user selects on the launch page.

If the selection is ZIP, I need to be sure that
the value of '_Non-Residential' is displayed as
'Non-Residential' in the report.

Thus far, I've come up with this,

quote:

DEFINE FILE &FNX
RFLAG/A1 = IF ZIP EQ '_Non-Residential' THEN '1' ELSE '0';
SRNAME/A60 = IF RFLAG EQ '1' THEN 'Non-Residential' ELSE ZIP;
END


but it does not consider when the file is not ZIP.

I would appreciate any shove I could get with this.

Any ideas? Confused

Thanks.

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


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
December 09, 2010, 05:28 PM
N.Selph
More dialog manager:
 
DEFINE FILE &FNX
-IF &RPTYP NE 'ZIP' GOTO :SKIPZIP;
RFLAG/A1 = IF ZIP EQ '_Non-Residential' THEN '1' ELSE '0';
SRNAME/A60 = IF RFLAG EQ '1' THEN 'Non-Residential' ELSE ZIP;
-:SKIPZIP
-IF &RPTYP EQ 'ZIP' GOTO :SKIPTHIS;
... and then code an alternate RFLAG and SRNAME field here for other values of &RPTYP with another statement
-:SKIPTHIS
END
 



(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
December 09, 2010, 05:31 PM
Waz
On first thoughts, perhaps some DM to select the defines lines needed.

DEFINE FILE &FNX
-IF &??? NE 'ZIP' THEN GOTO NO_ZIP ;
RFLAG/A1 = IF ZIP EQ '_Non-Residential' THEN '1' ELSE '0';
SRNAME/A60 = IF RFLAG EQ '1' THEN 'Non-Residential' ELSE ZIP;
-NO_ZIP
-IF &??? NE 'AGEGRP' THEN GOTO NO_AGEGRP ;
....
-NOAGEGRP
-IF &??? NE 'COVGRP' THEN GOTO NO_COVGRP ;
....
-NO_COVGRP 

END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 09, 2010, 05:51 PM
Tomsweb
Thanks guys, I get the idea. When I have it working, I'll post the solution.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
December 09, 2010, 06:27 PM
Tomsweb
Thanks N.Selph and Waz for planting the seed.

Here is the code I had in mind to solve my problem

quote:

DEFINE FILE &FNX
-IF &RPTTYPE EQ 'ZIP' GOTO 'XZIP' ELSE 'XALL';
-*
-XZIP
RFLAG/A1 = IF ZIP EQ '_Non-Residential' THEN '1' ELSE '0';
SRNAME/A60 = IF RFLAG EQ '1' THEN 'Non-Residential' ELSE ZIP ;
-GOTO XEND
-*
-XALL
SRNAME/A60 = &RPTTYPE ;
-XEND
END


of course, followed by:

quote:

TABLE FILE &FNX
PRINT
FIELD1
FIELD2
etc.
BY SRNAME
END


Thanks!


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
December 09, 2010, 08:53 PM
Dan Satchell
I don't think Dialogue Manager should be necessary:

DEFINE FILE &FNX
 SRNAME/A60 = IF &RPTTYPE EQ '_Non-Residential' THEN 'Non-Residential' ELSE &RPTTYPE ;
END

EDIT: The above code will cause an error if the maximum length of values in AGEGRP.ftm is less than 16. In that case, I would change the DEFINE to this, which has the added advantage of covering any other values beginning with '_' that might be added in the future:

DEFINE FILE &FNX
 SRNAME/A60 = IF &RPTTYPE LIKE '_%' THEN EDIT(&RPTTYPE,'$9999999999999999999999999999999999999999999999999') ELSE &RPTTYPE ;
END

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05