Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DEFINE'd field value lost

Status
Not open for further replies.

sagobogger

Technical User
Jun 18, 2004
69
US
This is a strange one. I always thought that a DEFINE persisted until the end of a .fex unless reset by something like a CLEAR or JOIN, so you could have all the DEFINE's at the start of the fex and then have multiple TABLE FILE reports off that file in the fex. Now I have run into a situation where a YYM date based DEFINE is losing its value and returning zero after the first report section, but the other DEFINEd fields work fine. I have a work around but I'm curious to know if anyone else has run into this. A simple example:

MYFILE with these fields:

MONTH YYM
DEPARTMENT A30
ITEM A20
SALES P15.2

Start of fex

DEFINE FILE MYFILE
FEB_SALES/P15.2 = IF MONTH EQ '200602' THEN SALES ELSE 0;
END

TABLE FILE MYFILE
SUM FEB_SALES SALES
BY ITEM
END

TABLE FILE MYFILE
SUM FEB_SALES SALES
BY DEPARTMENT
END

End of fex

FEB_SALES works in the first report, but returns zero in the second.

If I change the DEFINE to:

DEFINE FILE MYFILE
THISMO/YYM = '200602'
FEB_SALES/P15.2 = IF MONTH EQ THISMO THEN SALES ELSE 0;
END

then FEB_SALES works correctly in all the TABLE FILE reports in the .fex.

Ideas anyone?

 
Just for grins and giggles, if you run your second report, but change 'BY DEPARTMENT' to 'BY ITEM' (so it mirrors the first request), does the problem occur?
 
Yes it does. (That was actually how I tested, I didn't post it that way 'cause it looks dumb. If I -goto to jump directly to the second report then that one works so it's definitely losing it after the first use. Any other define not using the month works fine in multiple reports.
 
OK, here something to try (Since I don't have your file, I have to ask you to run the test):

after the first table, add a '? DEFINE'

This will show if the DEFINE stays, as well as if there are any DEFINEs in your MFD or in the environment (perhaps from a PROFILE).
 
Yes, there are some DEFINE's in the MFD.

Yes, ? DEFINE shows the defines are still there after the first report.

Not all the DEFINEd fields are lost, only this one:

FEB_SALES/P15.2 = IF MONTH EQ '200602' THEN SALES ELSE 0;

so it seems to be related to using the MONTH field directly in the define. If I add a DEFINE doing the same thing another way:

THISMO/YYM = '200602';
FEB_SALE2/P15.2 = IF MONTH EQ THISMO THEN SALES ELSE 0;
FEB_SALES/P15.2 = IF MONTH EQ '200602' THEN SALES ELSE 0;

then FEB_SALE2 continues to work, but FEB_SALES only works the first time around.

 
OK, this is getting weird. Can you tell me the platform, product (Focus/WebFOCUS/Developers Studio etc.) and release? Also, if you could post, or send the Master file to FOCwIZARD@ibi.com, I want to try and repro this thing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top