Focal Point
Creating define available to all reports?

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

October 12, 2007, 03:39 PM
Jason K.
Creating define available to all reports?
Is there a way to create a define statement so I can reference it in any report without having to define it in the report?

Like a system variable, such as &YYMD ...

Thanks!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
October 12, 2007, 03:44 PM
cmallain
Create an INCLUDE program on your windows server(I think...I've been trapped in the mainframe world for a few months) that does all the defines.

Then in each fex that needs to reference it have the following at the top before any other code:

-MRNOEDIT -INCLUDE zzdefineme


------------------------------------------
last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
October 12, 2007, 04:39 PM
Jason K.
Thanks cmallain! that's a great idea!

what would this included fex look like?
I thought I had to define the file that I was building the report off of.

Define file x
bow wow;
end
table file x
sum sales by dept
end

?


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
October 12, 2007, 04:52 PM
Darin Lee
this is going to be a little difficult unless none of the defines reference any fields (or every TABLE request is against the same file name.) All defines are unique to the table/segment where they are defined. For example

DEFINE FILE CAR
DMARGIN=RCOST - DCOST;
END

would not work if you TABLE FILE EMPLOYEE because those fields don't exist in employee.

If you have something like

DEFINE FILE CAR
TODAY_DT/YYMD='&YYMD';
END

where no real fields are referenced you could make it work. If you want TODAY_DT to be available in ANY request, add it to a .FEX without the DEFINE or END statements.

DATEFEX.FEX would look like

TODAY_DT/YYMD='&YYMD';

Note that this fex does NOT have to be standalone code (can be run by itself).

Then you could

DEFINE FILE CAR
-INCLUDE DATEFEX
END

OR

DEFINE FILE EMPLOYEE
-INCLUDE DATEFEX
END

The other alternative would be to include those define statements in each of the Master Files that you would use. This, however, causes problems sometimes when using amper variables because the MFD can't be parsed correctly.

This message has been edited. Last edited by: Darin Lee,


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 12, 2007, 04:59 PM
Diptesh Patel
If the DEFINE is based on columns in the specific table, why not put the define in the master for the table itself? That way any report that uses the table would have access to the define statement, without having to code it in the report. The drawback is that the master would have to be manually edited to add the define, and you'd have to remember to edit it again, if you ever recreate the master.


Diptesh
WF 7.1.7 - AIX, MVS
October 12, 2007, 06:19 PM
cmallain
Keep in mind that if you put a define in the MFD, it will execute every time, for every row of data. In my experience, it seemed to execute even if you don't use it. We experienced a HUGE drop in response time doing that.

As for how it would look, it would look like a regular define statment but Darin is correct, you'd have to know what to Define. I also made access to everyone for different version of the date and time, but I didn't use DEFINE, I used -SETs like this:

-***-SET &ECHO='ALL';
-* ZISYSDAT.FEX - Uses the current system date to determine various date/time derivations.
-* CREATED: 10/03/2005 - CMALLAIN
-* UPDATED:
-*-------------------------------------------------------------------------------------
-DEFAULT &NOWYYMD='99999999';
-*
-*IMPORTANT NOTE:
-*IMPORTANT NOTE:
-*IMPORTANT NOTE:
-*IMPORTANT NOTE:
-*IMPORTANT NOTE:
-*in EVERY program that uses this, you MUST set &NOWYYMD to the date that you wish
-* to process. Most likely it will be today's date, but then it's easily changeable
-* for testing purposes.
-*
-****copy this to your code and set as needed --> -SET &NOWYYMD='&YYMD.EVAL';
-*
-*just in case, it's forgotten, I'm going to default it to 99999999 and if
-* it's not there, then I'll default it to the current date....
-SET &XNOWYYMD=IF '&NOWYYMD.EVAL' EQ '99999999' THEN '&YYMD.EVAL' ELSE '&NOWYYMD.EVAL';
-*
-*now restate the original field with the value. It's better to see this transition using
-* 2 steps instead of just revising the original...trust me.
-SET &NOWYYMD='&XNOWYYMD.EVAL';
-*
-*pick out the current year
-SET &NOWYEAR=EDIT(&NOWYYMD,'9999$$$$');

etc.

I can email you the whole thing if you'd like.

I'm not sure how you're going to use these but if it's for date checking, then you can just use the &ervar and not waste the system time to redefine a new field.

Carol


------------------------------------------
last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
October 14, 2007, 09:28 AM
FrankDutch
Jason

You ask for a define but you suggest something like &YYMD

These are two different things.

I would suggest to use the edasprof.prf file to put amper values you use every day in several reports.
It's all done with -SET commands and you create double amper values like "&&YESTERDAY" or "&&PREVWORKDAY"




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 14, 2007, 11:19 AM
Tom Flynn
Jason K,

See Susannah's answer to Rounding Function

This should give you lot's of ideas...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
October 14, 2007, 09:38 PM
TexasStingray
I do not know if you know this but you can also create your own variables like &YMD, etc...

just add them to the edasprof.prf file using a -SET statement. Here is an example:

-SET &COMPANYNAME = 'Information Builders, Inc.'; 


To use it in a heading all you have to do is all &COMPANYNAME. You could youe them in DEFINES, COMPUTES, etc...

You can also use most if not all the built in functions like EDIT, CTRAN, SUBSTR, etc...




Scott