Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


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

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report 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: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report 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: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report 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: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report 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

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report 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: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report 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

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Guru
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: 253 | Location: Melbourne, Australia | Registered: February 07, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

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-2020 Information Builders