IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    [SOLVED] Weird behaviour in WF 7.6
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hello I noticed something that troubles me ( maybe it's not a bug but I am not aware of the situation ). I have a define block with some new virtual fields defined but it seems that when I try to print some of them they are not printed correctly unless I print the other defined fields on which they depend.
Here is a snippet of the code:

DEFINE FILE TABL1
col1_V1/D15.3 = col1_V1 + some_table_col1;
col_new/D15.3 = col1_V1;
col1_V1/D15.3 = IF some_ather_col NE LAST some_other_col THEN 0 ELSE col1_V1;
END
-RUN

TABLE FILE TABLE1
PRINT col1_new
END
-RUN

LET'S say I have two columns in table1 then the result is something like:
col1_new
--------
-200,000
.000

When I print col1_V1 with NOPRINT:

TABLE FILE TABLE1
PRINT
col_V1 NOPRINT
col1_new
END
-RUN

then there is no problem and col1_new prints as expected:

col1_new
--------
-200,000
200,000

( I use then col1_new in a subfoot )

So why is this happening ?!?
Thanks in advance.

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


WF 7.6.5 / OS: XP / FOCUS
 
Posts: 29 | Registered: September 01, 2008Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
AS it appears to be such a simple request

Create a repro against the car database, that way we can all play with it in the various versions
of 76 that are available.

Not knowing what the 76(X) X bit is means you could be on anything from 7.6.0 to 7.6.7

Also XP is not a WebFocus platform it's for Dev Studio only.
Is this just Dev Studio or do you have a server hiding some where?
 
Posts: 949 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Here is the example with the CAR table ( the same strange behaviour - or at least strange to me Smiler )

DEFINE FILE CAR
WIDTH_T1/D6 = WIDTH_T1+WIDTH;
TEMPVAR/D6 = WIDTH_T1;
WIDTH_T1/D6 = IF MODEL NE LAST MODEL THEN 0 ELSE WIDTH_T1;
END
-RUN

TABLE FILE CAR
PRINT
TEMPVAR
WIDTH_T1 NOPRINT
END
-RUN
-EXIT


Try printing it without WIDTH_T1 NOPRINT and you'll see that different result prints for TEMPVAR . ( I am using WF 7.6.5 )
I am using the Dev Studio under XP.

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


WF 7.6.5 / OS: XP / FOCUS
 
Posts: 29 | Registered: September 01, 2008Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
It is showing exactly the correct behaviour.

By using WIDTH_T1 NOPRINT it causes WIDTH_T1/D6 = IF MODEL NE LAST MODEL THEN 0 ELSE WIDTH_T1; to be processed
This sets WIDTH_T1 back to 0 for every new row.

Because it is created in a DEFINE and not a compute, not referencing WIDTH_T1 in the request
means that the calculation is never performed and so WIDTH_T1 does not get set back to 0.

Each new output row is then EQ to the last value of WIDTH_T1 + the value of the new input row.
 
Posts: 949 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
JG is correct

NOPRINT means a field is included in the report generation but excluded when report is displayed to screen.

To achieve the behaviour you want is to effectively comment the field out.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 848 | Location: Airstrip One | Registered: October 06, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
I see - hammo you probably meant that I should leave the field with NOPRINT. Because my purpose is to print the TEMPVAR field but when MODEL changes WIDTH_T1 is set to 0 ( and TEMPVAR preserves the value of WIDTH_T1 to be used later).
Thanks both for the response.


WF 7.6.5 / OS: XP / FOCUS
 
Posts: 29 | Registered: September 01, 2008Reply With QuoteEdit or Delete MessageReport This Post
SH
Member
Posted Hide Post
I am wondering, is there a way to force WF (maybe by an option) to compute all the fields that are created in a define, so that we avoid using NOPRINT?


WebFOCUS 7.6, Windows XP, Output: HTML, PDF
 
Posts: 4 | Registered: August 22, 2008Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
Think about things logically and reverse the order of the defined columns

DEFINE FILE CAR
WIDTH_T1/D6 = IF MODEL NE LAST MODEL THEN 0 ELSE WIDTH_T1;
WIDTH_T1/D6 = WIDTH_T1+WIDTH;
TEMPVAR/D6 = WIDTH_T1;
END
-RUN
TABLE FILE CAR
PRINT
TEMPVAR
END
-RUN

That actually does what you want in this instance

Using model as the change column is actually a bad choice because there is
only 1 row in the data for MODEL.

Use COUNTRY instead and you see the effect which I believe is required which
is to give a running total based on doing a print
 
Posts: 949 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
It was a more complicated situation but your suggestion applied perfectly Smiler Thanks JG.


WF 7.6.5 / OS: XP / FOCUS
 
Posts: 29 | Registered: September 01, 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] Weird behaviour in WF 7.6

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