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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Add left padding to column date

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Add left padding to column date
 Login/Join
 
Member
posted
I have a problem where I have a sql statement that adds padding on the left of a column of data, but it does not translate into the webfocus sql report.

Is there a way to left pad data once in the report?

nbsp goes between the td's even in code brackets, it makes tabs. =p

I tried adding <td> </td>, but it thinks the nbsp is a variable.


select substr(lpad('<td> </td>',2*level) || component_part_no, 1, 150), parent_part_number, level from dw_bill_of_materials where job_number = 'STD' connect by prior component_part_no = parent_part_number start with parent_part_number = '0001';

If possible, i would like to avoid doing the indenting in the sql and have it just in the report so it translates to more formats then just HTML.

Thanks.

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


WebFocus 7.6.2, MRE through SharePoint, Win XP/2k3.
 
Posts: 22 | Registered: May 30, 2007Report This Post
Expert
posted Hide Post
Chet, when you post programming code, put it within code tags, then the TDs and other bits of code will display correctly.

[code]
this is my code
[/code]


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I wouldn't manipulate the width or padding of a data column in SQL - I would use SQL for data retrieval only, then use WebFOCUS for styling the report.

You would like to pad the data column for HTML and other formats - the
<td>& nbsp;</td>
in your SQL will only work for HTML, not for PDF.

For HTML, you can use CSS styling to control the width of the data column (you need to set HTMLCSS ON to create an internal CSS stylesheet:

SET PAGE=NOLEAD
SET SQUEEZE=ON
TABLE FILE CAR
SUM
SALES
BY COUNTRY
HEADING
"WEBFOCUS REPORT"
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=SALES, WRAP=3, JUSTIFY=RIGHT, $
END


For PDF, you can use the WebFOCUS style tag WRAP:

SET PAGE=NOLEAD
SET SQUEEZE=ON
TABLE FILE CAR
SUM
SALES
BY COUNTRY
HEADING
"WEBFOCUS REPORT"
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=SALES, WRAP=3, $
END


There are probably other ways to achieve this.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
I think I might have misrepresented what I am trying to achieve.

I am looking to take a value from a row and left pad according to its level value.

So right now my results are this.

part level
---- -----
0000 1
0001 2
0002 2
0003 3
0004 2

I would want the report to show like this...

part level
---- -----
0000 1
 0001 2
 0002 2
  0003 3
 0004 2


basically, left pad the part field with spacing by using its level number on a per row basis.

I was thinking a way to do this would to substr it somehow into a defined field where i desinate the start position based on a calulation of the level.

so if its level one start would be (1*3), level two would be (2*3), etc, but I cant figure out a way to tell it to start at a position that i define.

I almost had this using FML, but it failed to show right because the table is not considered a true hierarchy.

This sql statement does give the right results, but now I am stuck at presenting the report as needed. =(


WebFocus 7.6.2, MRE through SharePoint, Win XP/2k3.
 
Posts: 22 | Registered: May 30, 2007Report This Post
Member
posted Hide Post
for anyone else that is curious, i was able to solve this for html doing the following the in sql.
select replace(substr(lpad(' ',2*level)||component_part_no,1,150), ' ', '& |nbsp& |nbsp') as "component_part", parent_part_number, level as "level1" from dw_bill_of_materials where job_number = 'STD' connect by prior component_part_no = parent_part_number start with parent_part_number = '0001';


it doesnt solve my pdf/excel format types, but its a start. =p


WebFocus 7.6.2, MRE through SharePoint, Win XP/2k3.
 
Posts: 22 | Registered: May 30, 2007Report This Post
Expert
posted Hide Post
If you're writing separate programs for each output type, and you've solved the HTML version, here's an example for PDF - you can simply prepend a number of spaces before the data:

TABLE FILE CAR
SUM
COMPUTE
CONT1/A20 = IF COUNTRY IN ('ENGLAND', 'JAPAN') THEN '   ' | COUNTRY ELSE IF COUNTRY EQ 'FRANCE' THEN '    ' | COUNTRY ELSE COUNTRY;

BY COUNTRY NOPRINT
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
FONT='ARIAL', SIZE=8, $
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
You can combine your html solution and Francis PDF solution into one report.

the output format can be put into an amper value

-DEFAULT &FORMAT='PDF'; (ask for either HTML or PDF)

....
COMPUTE
FRANCIS/A20=IF COUNTRY IN ('ENGLAND', 'JAPAN') THEN '   ' | COUNTRY ELSE IF COUNTRY EQ 'FRANCE' THEN '    ' | COUNTRY ELSE COUNTRY;
YOURS/A20=IF COUNTRY IN ('ENGLAND', 'JAPAN') THEN '|nbsp& |nbsp&'| COUNTRY ELSE IF COUNTRY EQ 'FRANCE' THEN '|nbsp&|nbsp&|nbsp&' | COUNTRY ELSE COUNTRY;

COMPUTE 
CONT1/A20=IF &FORMAT EQ 'PDF' THEN FRANCIS ELSE YOURS;

....


(I'm not sure if the "space" code in HTML is the correct one, but others will know how to do this).




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Chet,

Frank's example is the way to go.

The HTML space to code in a fex is '&|nbsp;', the pipe (|) is there to circumvent Dialogue Manager from trying to use   as a variable.

Cheers.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
thanks for all your help. I was not aware of the pipe option to ignore as a variable. also, the option to change the report by report type is going to be useful as well.

thanks again!


WebFocus 7.6.2, MRE through SharePoint, Win XP/2k3.
 
Posts: 22 | Registered: May 30, 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     Add left padding to column date

Copyright © 1996-2020 Information Builders