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] How to Repeat a Value for each row
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] How to Repeat a Value for each row
 Login/Join
 
Platinum Member
posted
Hello All
I need to repeat a value for every row
For example I have column called flda, it has a value , I need to repeat this value for all other rows in fldb
example
flda fldb
row1 0001 45
row2 0002 0
row3 0003 0
row4 0004 0
...
row99 0099 0

in the above example I will need fldb with the value of 45 for all rows

Thanks

This message has been edited. Last edited by: FP Mod Chuck,


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
 
Posts: 134 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Guru
posted Hide Post
YOu can use PARTITION_AGGR fo rthis:

 
DEFINE FILE CAR
SRT/I1=0;
END
TABLE FILE CAR
PRINT SALES 
COMPUTE FST/D12.2M = PARTITION_AGGR(SALES, SRT, B, C, FST);
BY SRT
BY COUNTRY
WHERE COUNTRY EQ 'W GERMANY'
ON TABLE SET PAGE NOLEAD
END
 


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 439 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
quote:
PARTITION_AGGR


Thank You I tried that , for some reason it does not like

 
 DEFINE FILE CAR
 SRT/I1=0;
 END
 TABLE FILE CAR
 PRINT SALES
 COMPUTE FST/D12.2M = PARTITION_AGGR(SALES, SRT, -1, C, FST);
 BY SRT
 BY COUNTRY
 WHERE COUNTRY EQ 'W GERMANY'
 ON TABLE SET PAGE NOLEAD
 END
 0 ERROR AT OR NEAR LINE      9  IN PROCEDURE ADHOCRQ FOCEXEC *
 (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: C
 (FOC009) INCOMPLETE REQUEST STATEMENT
 BYPASSING TO END OF COMMAND


 


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
 
Posts: 134 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
i THINK THIS FEATURE IS NOT AVAILABLE IN 8.1.5m WHICH WE HAVE


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
 
Posts: 134 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Master
posted Hide Post
If you don't have a need to partition by a BY field then you can set up a simple counter using LAST (you can then hide the counter with a NOPRINT). Then using IF...THEN logic you can bring down the values of the first line.

  
TABLE FILE GGSALES
PRINT  
   COMPUTE COUNTER/I4 = LAST COUNTER + 1; NOPRINT
   COMPUTE flda/A4 = EDIT(COUNTER);
   COMPUTE fldb/I11 = IF COUNTER EQ 1 THEN DOLLARS ELSE LAST fldb;
BY PCD NOPRINT
ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE SET STYLE *
TYPE=REPORT, LINES-PER-PAGE=UNLIMITED, $
END


If you want to break it up between BY fields you can do that as well using LAST
  
TABLE FILE GGSALES
PRINT  
   COMPUTE PARTITION_NUM/I4 = IF PCD NE LAST PCD THEN PARTITION_NUM + 1 ELSE PARTITION_NUM; 
   COMPUTE PARTITION_ROW/I4 = IF PCD NE LAST PCD THEN 1 ELSE LAST PARTITION_ROW + 1;
   COMPUTE FIRST_DOLLARS/I11 = IF PARTITION_ROW EQ 1 THEN DOLLARS ELSE LAST FIRST_DOLLARS;
   COMPUTE RUNNING_TOTAL/I11 = IF PARTITION_ROW EQ 1 THEN DOLLARS ELSE LAST RUNNING_TOTAL + DOLLARS ;
BY PCD
ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE SET STYLE *
TYPE=REPORT, LINES-PER-PAGE=UNLIMITED, $
END

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 605 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to Repeat a Value for each row

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