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] Building a new column with prior values
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Building a new column with prior values
 Login/Join
 
Master
posted
I am trying to create a prototype from the CAR file.
My goal is to create a new column, SALES2.

I want to carry the last value for the BMW cars (15600)
to the 1st record of the SALES2 column (the red text).


<HTML>
<HEAD>
<TITLE> BUILD COLUMNS WITH NUMBERS
</TITLE>
</HEAD>

<BODY>

<TABLE ALIGN=CENTER WIDTH=300 BORDER="2">
<TR>
<TD ALIGN=CENTER>COUNTRY</TD><TD ALIGN=CENTER>CAR</TD><TD ALIGN=CENTER>SALES<TD ALIGN=CENTER>SALES2</TD>
</TR>
<TR>
<TD ALIGN=CENTER>W GERMANY</TD><TD ALIGN=CENTER>AUDI<TD ALIGN=CENTER>7800</TD><TD ALIGN=CENTER><FONT COLOR="RED">[b]15600[/b]</FONT></TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>8950</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>8900</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>14000</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>18940</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>14000</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>15600</TD><TD ALIGN=CENTER> </TD>
</TR>


<!--- Identifying a Report Component in a WebFOCUS Style Sheet ---?
</TABLE>

</BODY>

</HTML>



Has anyone ever done this in their reports?

Thank you.

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
 
Posts: 553 | Location: Baltimore, MD | Registered: July 06, 2006Reply With QuoteReport This Post
Master
posted Hide Post
I thought of this on the elevator.

TABLE FILE CAR
SUM 
MAX.SALES
BY COUNTRY
-*
PRINT SALES
BY COUNTRY
WHERE COUNTRY EQ 'W GERMANY';
END
-RUN
-EXIT


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 553 | Location: Baltimore, MD | Registered: July 06, 2006Reply With QuoteReport This Post
Master
posted Hide Post
quote:
Originally posted by Tomsweb:
I thought of this on the elevator.

TABLE FILE CAR
SUM 
LST.SALES
BY COUNTRY
-*
PRINT SALES
BY COUNTRY
WHERE COUNTRY EQ 'W GERMANY';
END
-RUN
-EXIT


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 553 | Location: Baltimore, MD | Registered: July 06, 2006Reply With QuoteReport This Post
Master
posted Hide Post
quote:
Originally posted by Tomsweb:
I am trying to create a prototype from the CAR file.
My goal is to create a new column, SALES2.

I want to carry the last value for the BMW cars (15600)
to the 1st record of the SALES2 column (the red text).


<HTML>
<HEAD>
<TITLE> BUILD COLUMNS WITH NUMBERS
</TITLE>
</HEAD>

<BODY>

<TABLE ALIGN=CENTER WIDTH=300 BORDER="2">
<TR>
<TD ALIGN=CENTER>COUNTRY</TD><TD ALIGN=CENTER>CAR</TD><TD ALIGN=CENTER>SALES<TD ALIGN=CENTER>SALES2</TD>
</TR>
<TR>
<TD ALIGN=CENTER>W GERMANY</TD><TD ALIGN=CENTER>AUDI<TD ALIGN=CENTER>7800</TD><TD ALIGN=CENTER><FONT COLOR="RED">[b]15600[/b]</FONT></TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>8950</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>8900</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>14000</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>18940</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>14000</TD><TD ALIGN=CENTER> </TD>
</TR>

<TR>
<TD ALIGN=CENTER> </TD><TD ALIGN=CENTER>BMW<TD ALIGN=CENTER>15600</TD><TD ALIGN=CENTER> </TD>
</TR>


<!--- Identifying a Report Component in a WebFOCUS Style Sheet ---?
</TABLE>

</BODY>

</HTML>



Has anyone ever done this in their reports?

Thank you.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 553 | Location: Baltimore, MD | Registered: July 06, 2006Reply With QuoteReport This Post
Master
posted Hide Post

Are you saying that you would like the final output to look like this:

COUNTRY CAR SALES SALES2
W GERMANY AUDI 7800 15600
BMW 8950
BMW 8900
BMW 14000
BMW 18940
BMW 14000
BMW 15600

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


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 485 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Master
posted Hide Post
yes


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 553 | Location: Baltimore, MD | Registered: July 06, 2006Reply With QuoteReport This Post
Master
posted Hide Post
It's an ugly hack, but...
  
TABLE FILE CAR
SUM LST.SALES WITHIN COUNTRY AS 'LSTSALES'
BY COUNTRY
PRINT SALES
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'W GERMANY';
ON TABLE HOLD AS TEMP
ON TABLE SET ASNAMES ON
ON TABLE SET PAGE-NUM OFF
END
-RUN

TABLE FILE TEMP
PRINT COMPUTE CNTR/I7=LAST CNTR+1; NOPRINT
    CAR
    SALES
    COMPUTE SALES2/I11 MISSING ON = IF CNTR EQ 1 THEN LSTSALES ELSE MISSING;
BY COUNTRY
BY CAR NOPRINT
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET NODATA ''
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES2, COLOR=RED, $
ENDSTYLE
END

🤣


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 485 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Platinum Member
posted Hide Post
If you are using 8.2x then the analytic functions can help

  
TABLE FILE CAR
SUM 
     COMPUTE SALES2/I6 = PARTITION_AGGR(LST.SALES, COUNTRY, B, E, LST);
BY  CAR.ORIGIN.COUNTRY
PRINT 
     CAR.BODY.SALES
     COMPUTE SALES3/I6 = PARTITION_AGGR(LST.SALES, COUNTRY, B, E, LST);
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
WHERE COUNTRY EQ 'W GERMANY';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=REPORT,
     COLUMN=N1,
     SEQUENCE=1,
$
TYPE=REPORT,
     COLUMN=N2,
     SEQUENCE=5,
$
TYPE=REPORT,
     COLUMN=N3,
     SEQUENCE=2,
$
TYPE=REPORT,
     COLUMN=N4,
     SEQUENCE=3,
$
TYPE=REPORT,
     COLUMN=N5,
     SEQUENCE=4,
$
ENDSTYLE
END


Cheers

Stu


WebFOCUS 8.2.03 (8.2.06 in testing)
 
Posts: 241 | Location: Melbourne, Australia | Registered: February 07, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Building a new column with prior values

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