[SOLVED]Getting rid of leading spaces in hyperlink
Hi All,
I have a report that displays information by office. Some office have child offices that we have chosen to offset with 4 spaces and display in italics. The office column is a drill down column that dills to another report. Currently, because of the spaces the hyperlink for child offices is displaying with the leading spaces being part of the hyperlink. See sample below.
Is there a way to exclude leading spaces when showing the cell as a hyperlink (maybe including html in code)?
Thanks BThis message has been edited. Last edited by: bflemi3,
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 27, 2010, 11:37 AM
njsden
Well, if your report is to be delivered in HTML only, you could add some kind of indicator to your output to determine if an indentation is to be displayed and use Javascript to manipulate the HTML output accordingly.
DEFINE FILE CAR
NEW_CAR/A50 = IF CAR EQ 'JAGUAR' OR 'JENSEN' OR 'MASERATI' THEN '@' || CAR ELSE CAR;
END
TABLE FILE CAR
SUM
RETAIL_COST AS 'Retail'
DEALER_COST AS 'Dealer'
BY COUNTRY AS 'Country'
BY NEW_CAR AS 'Car'
ON TABLE HOLD AS HRESULTS FORMAT HTMTABLE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=NEW_CAR, FOCEXEC=DUMMY, $
END
-RUN
-HTMLFORM BEGIN
<html><head><title>My cars</title></head>
<body>!IBI.FIL.HRESULTS;</body>
<script type="text/Javascript">
window.onload = function() {
// Do your Javascript magic here to implement indentation when @ is found!
// blah
};
</script>
</html>
-HTMLFORM END
DEFINE FILE CAR
CAR_LINK/A200 = IF (CAR EQ 'JAGUAR' OR 'JENSEN' OR 'MASERATI')
THEN '<div>&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;<a href="/ibi_apps/WFServlet?IBIF_ex=myproc.fex">' || CAR || '</a></div>'
ELSE '<a href="/ibi_apps/WFServlet?IBIF_ex=myproc.fex">' || CAR || '</a>';
END
TABLE FILE CAR
SUM
RETAIL_COST AS 'Retail'
DEALER_COST AS 'Dealer'
BY COUNTRY AS 'Country'
BY CAR_LINK AS 'Car'
ON TABLE SET STYLE *
END
Of course, you'll be attempting to re-implement a feature that WF provides out-of-the-box but it is still an option.
Hope that helps.This message has been edited. Last edited by: njsden,
Thank you njsden for both replies. I really like your second post but how would I pass parameters to the downstream report if I'm creating the link in the define?
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 27, 2010, 02:19 PM
T.Peters
Why can't you use the TRIM function and trim all leading spaces?
WebFOCUS: 7702 O/S : Windows Data Migrator: 7702
July 27, 2010, 02:33 PM
bflemi3
the spaces denote a child office. It's a visual queue along with the italics.
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 27, 2010, 02:59 PM
njsden
bflemi3, just concatenate the value wherever you need it. For example, to run myproc.fex passing a value to &MYCAR, you could have something like this:
CAR_LINK/A200 = IF (CAR EQ 'JAGUAR' OR 'JENSEN' OR 'MASERATI')
THEN '<div>&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;<a href="/ibi_apps/WFServlet?IBIF_ex=myproc.fex&|MYCAR=' || CAR || '">' || CAR || '</a></div>'
ELSE '<a href="/ibi_apps/WFServlet?IBIF_ex=myproc.fex&|MYCAR=' || CAR || '">' || CAR || '</a>';
It is a bit cumbersome particularly if you'll be dealing with many parameters but that's the cost to pay when one chooses not to take advantage of the standard functionality that comes with the product.
You could use FOCEXEC along with Javascript code to manipulate the anchors after the output has been generated, but that may not necessarily be simpler. Sort of a trade off due to the special requirement you have.
You might be able to do all of the formatting in the StyleSheet:
TABLE FILE CAR
SUM
RETAIL_COST AS 'Retail'
DEALER_COST AS 'Dealer'
COMPUTE CHILD_FLAG/A1 = IF CAR EQ 'JENSEN' OR 'MASERATI' THEN 'Y' ELSE 'N'; NOPRINT
BY COUNTRY AS 'Country'
BY CAR AS 'Car'
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=CAR, FOCEXEC=DUMMY, JUSTIFY=LEFT, WHEN=CHILD_FLAG EQ 'N', $
TYPE=DATA, COLUMN=CAR, FOCEXEC=DUMMY, STYLE=ITALIC, JUSTIFY=RIGHT, WHEN=CHILD_FLAG EQ 'Y', $
ENDSTYLE
END
WebFOCUS 7.7.05
July 27, 2010, 03:47 PM
bflemi3
OK, I'll give it a shot njsden. Thank you for your help.
B
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 27, 2010, 05:53 PM
Waz
You could do this in a cascading style sheet, assuming this is only HTML.
-HTMLFORM BEGIN
<style>
.Indent {
padding-left: 20px;
}
</style>
-HTMLFORM END
DEFINE FILE CAR
CHILD/A1 = IF COUNTRY EQ 'ITALY' THEN 'Y' ELSE 'N' ;
END
TABLE FILE CAR
PRINT CHILD NOPRINT
BY COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE SET CSSURL mycss.css
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=COUNTRY, FOCEXEC=drill, $
TYPE=DATA, COLUMN=COUNTRY, WHEN=CHILD EQ 'Y', CLASS=Indent, FOCEXEC=drill, $
ENDSTYLE
END
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 28, 2010, 08:32 AM
njsden
Cool! I like that alternative. Much cleaner and easier to implement.
Originally posted by njsden: Cool! I like that alternative. Much cleaner and easier to implement.
I agree. Thanks Waz!
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 28, 2010, 02:50 PM
bflemi3
This works great.
But, there's always a but, does anyone know how to deal with this for pdf and excel outputs?
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)
July 28, 2010, 05:55 PM
Waz
You may have to deal with each individually, although I wonder if you created the HTML report and sent it to Excel with SET HTMLFORMTYPE, whether it will still work.
As for PDF, here is an old programmers trick.
DEFINE FILE CAR
CHILD/A1 = IF COUNTRY EQ 'ITALY' THEN 'Y' ELSE 'N' ;
CTY1/A4 = IF CHILD EQ 'Y' THEN ' ' ELSE EDIT(COUNTRY,'9999') ;
CTY2/A10 = IF CHILD EQ 'Y' THEN COUNTRY ELSE EDIT(COUNTRY,'$$$$999999') ;
END
TABLE FILE CAR
PRINT CHILD NOPRINT
BY COUNTRY NOPRINT
BY CTY1 AS 'COUN'
BY CTY2 AS 'TRY' IN +0
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=CTY2, FOCEXEC=drill, $
TYPE=DATA, COLUMN=CTY2, WHEN=CHILD EQ 'Y', FOCEXEC=drill, $
TYPE=DATA, COLUMN=CTY1, WHEN=CHILD EQ 'N', FOCEXEC=drill, $
ENDSTYLE
END
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 29, 2010, 09:20 AM
bflemi3
Thank you Waz, I'll look into this.
WebFOCUS 7.7 Windows All Output (Excel, HTML, PDF)