Focal Point
[SOLVED] Setting Hyperlink with Dynamic Parameter in Fex in 82

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2057049196

November 06, 2019, 03:06 PM
JulieA
[SOLVED] Setting Hyperlink with Dynamic Parameter in Fex in 82
FocalPoint Community,

I need to create hyperlinks to external website based on a dynamic parameter. The user selects a store, and everything (including the URL) populates the fex.

Here is my code:

TABLE FILE STOREDIR
PRINT
     STOREDIR.STOREDIR.STORE_ID NOPRINT
ON TABLE SUBHEAD
"<STOREDIR.STOREDIR.STORE"
"<STOREDIR.STOREDIR.ADDRESS"
"<STOREDIR.STOREDIR.CITY <STOREDIR.STOREDIR.STATE <STOREDIR.STOREDIR.ZIP"
"<STOREDIR.STOREDIR.PHONE"
"<STOREDIR.STOREDIR.URL"
" "
WHERE STOREDIR.STOREDIR.STORE_TYPE EQ '&STORE_TYPE.(<Convenience>).Type:.';
WHERE STOREDIR.STOREDIR.STORE EQ '&STORE.(FIND STOREDIR.STOREDIR.STORE IN STOREDIR).STORE:.';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
TYPE=REPORT, JUSTIFY=LEFT,
$
TYPE=TABHEADING,
LINE=1,
OBJECT=FIELD,
JUSTIFY=LEFT,
STYLE=BOLD,
SIZE=12,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=2,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
LINE=3
OBJECT=FIELD,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=4,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=5,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=REPORT,
     COLUMN=N2,
     BORDER-TOP=OFF,
     BORDER-BOTTOM=OFF,
     BORDER-LEFT=OFF,
     BORDER-RIGHT=OFF,
     FONT='CALIBRI',
     SIZE=11,
$
TYPE=TABHEADING,
LINE=5,
OBJECT=FIELD,
ITEM=1,
URL="<STOREDIR.STOREDIR.URL",
$
ENDSTYLE
END
-RUN
-EXIT  


I have reviewed pages 769-771 and 797-808 of Creating Reports With WebFOCUS Language Release 8.2 Version 04, and I'm close. I'm clearly missing something though about how to get the link working because I keep receiving "WebFOCUS Error
No query information to decode."

I'm struggling with the syntax of the URL and parameter together.

 TYPE=type, [subtype], URL=url[(parameters...)],
WHEN=expression,[TARGET=frame,] $


Clearly, I'm missing something about making the parameters work. Thoughts?

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


WebFocus 8.2.04
WebFocus 8.2.04

November 06, 2019, 04:08 PM
BabakNYC
If the field called URL already has the link to the url you want, just make it a link instead of a drill down. Here's an example:
  
DEFINE FILE CAR
URL1/A50= IF COUNTRY EQ 'ENGLAND' THEN 'http://www.jaguarusa.com'
ELSE IF COUNTRY EQ 'JAPAN' THEN 'http://www.toyota.com'
ELSE 'http://www.ford.com';
URL2/A255= '<a href='||''''|| URL1 | '''' | '>' || CAR.MODEL ||'</a>';
END

TABLE FILE CAR
PRINT
URL2 AS 'URL'
BY COUNTRY
ON TABLE PCHOLD FORMAT HTML
END



WebFOCUS 8206, Unix, Windows
November 06, 2019, 04:54 PM
JulieA
Thank you both for the replies.

I ended up using the second option. It works beautifully!

Thanks again.

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


WebFocus 8.2.04
WebFocus 8.2.04

November 06, 2019, 05:03 PM
Hallway
To build on what BabakNYC said, you can put html tags in your report and it will render the html. You need to make sure that you have SET HTMLENCODE = OFF.

Below is an example of how to use it in your report.

SET HTMLENCODE = OFF

DEFINE FILE STOREDIR
ANCHOR/A100V='<a href="' || STOREDIR.STOREDIR.URL || '" target="_blank">' || STOREDIR.STOREDIR.URL || '</a>';
END 
TABLE FILE STOREDIR
PRINT
     STOREDIR.STOREDIR.STORE_ID NOPRINT
     ANCHOR NOPRINT
ON TABLE SUBHEAD
"<STOREDIR.STOREDIR.STORE"
"<STOREDIR.STOREDIR.ADDRESS"
"<STOREDIR.STOREDIR.CITY <STOREDIR.STOREDIR.STATE <STOREDIR.STOREDIR.ZIP"
"<STOREDIR.STOREDIR.PHONE"
"<ANCHOR"
" "
WHERE STOREDIR.STOREDIR.STORE_TYPE EQ '&STORE_TYPE.(<Convenience>).Type:.';
WHERE STOREDIR.STOREDIR.STORE EQ '&STORE.(FIND STOREDIR.STOREDIR.STORE IN STOREDIR).STORE:.';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
TYPE=REPORT, JUSTIFY=LEFT,
$
TYPE=TABHEADING,
LINE=1,
OBJECT=FIELD,
JUSTIFY=LEFT,
STYLE=BOLD,
SIZE=12,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=2,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
LINE=3
OBJECT=FIELD,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=4,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=TABHEADING,
OBJECT=FIELD,
LINE=5,
SIZE=11,
JUSTIFY=LEFT,
FONT=CALIBRI,
$
TYPE=REPORT,
     COLUMN=N2,
     BORDER-TOP=OFF,
     BORDER-BOTTOM=OFF,
     BORDER-LEFT=OFF,
     BORDER-RIGHT=OFF,
     FONT='CALIBRI',
     SIZE=11,
$
ENDSTYLE
END
-RUN
-EXIT  
 



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
November 14, 2019, 11:43 AM
JulieA
FocalPoint Community,

I've opened this discussion again.

The solution worked beautifully for me relative to HTML reports.

I've added a user selection for output type. Users can select Excel or HTML.

For the HTML type, the links work perfectly.

For Excel, the line ends up showing the all the HTML code and repeating the url address twice.

I'm thinking about using the dialogue manager to separate a report formatted as HTML and a report formatted as Excel. My report is contained within a reporting object.

Is that the best approach?


WebFocus 8.2.04
WebFocus 8.2.04

November 14, 2019, 04:56 PM
NARSA
Hi,

Try this.

DEFINE FILE CAR
URL1/A50= IF COUNTRY EQ 'ENGLAND' THEN 'http://www.jaguarusa.com'
ELSE IF COUNTRY EQ 'JAPAN' THEN 'http://www.toyota.com'
ELSE 'http://www.ford.com';
END

TABLE FILE CAR
PRINT
URL1 NOPRINT
BY COUNTRY
BY MODEL
ON TABLE PCHOLD FORMAT XLSX
ON TABLE SET STYLE *
TYPE=DATA,COLUMN=N2,URL=(URL1), $
ENDSTYLE
END


WebFOCUS 7x & 8x

November 14, 2019, 05:07 PM
JulieA
Thank you, NARSA, for the reply.

I'm curious as to how this will work in a reporting object dependent on a user selection.

My users can select either HTML or Excel from a dropdown list in a filter panel tied to a reporting object.

Do you agree I need to use the Dialog Manager to direct the report output?


WebFocus 8.2.04
WebFocus 8.2.04

November 15, 2019, 07:17 AM
MartinY
@JulieA

NARSA option does work for either HTML or Excel format
Except if you have specific case that is not answered with that solution there is no reason to split or control the code with DM


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 15, 2019, 08:51 AM
JulieA
MartinY,

Thank you for your reply.

I understand what you said about NARSA's solution, but I'm not sure I'm asking my question correctly.

So, I'll try to explain things a little bit differently.

I used Hallway's solution in my reporting object.

It works great for HTML format.

Then, I was asked to create a dropdown list for users to select either HTML or Excel.

I created that dropdown list in a filter panel, and I introduced new behavior into my portal.

When a user selects Excel and downloads the report, the URL repeats itself and includes some of the html code in it. In other words, I get something like this:

 https://www.toyota.com/resources/Camry.pdf 


Is a Dialog Manager approach the best option for this reporting object?

Or, is there a different approach? Should I create a fex that selects the appropriate report and tie a report fex to the control for the selected format?

I need an approach that is dynamic in nature as I have nearly a hundred hyperlinks, and the number is expected to grow in the future.

Thanks.

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


WebFocus 8.2.04
WebFocus 8.2.04

November 15, 2019, 09:34 AM
NARSA
quote:
Originally posted by JulieA:
MartinY,

Thank you for your reply.

I understand what you said about NARSA's solution, but I'm not sure I'm asking my question correctly.

So, I'll try to explain things a little bit differently.

I used Hallway's solution in my reporting object.

It works great for HTML format.

Then, I was asked to create a dropdown list for users to select either HTML or Excel.

I created that dropdown list in a filter panel, and I introduced new behavior into my portal.

When a user selects Excel and downloads the report, the URL repeats itself and includes some of the html code in it. In other words, I get something like this:

 https://www.toyota.com/resources/Camry.pdf 


Is a Dialog Manager approach the best option for this reporting object?

Or, is there a different approach? Should I create a fex that selects the appropriate report and tie a report fex to the control for the selected format?

I need an approach that is dynamic in nature as I have nearly a hundred hyperlinks, and the number is expected to grow in the future.

Thanks.



Hi JulieA,


How did you create the dropdown list.

"I created that dropdown list in a filter panel, and I introduced new behavior into my portal."


WebFOCUS 7x & 8x

November 15, 2019, 09:46 AM
JulieA
To create my reporting object and filter panel, I followed the steps outlined on pages 273-279 (Chapter 8: Enhancing Portals Using Interactive Features and Coding Techniques) of the Business Intelligence Portal Release 8.2 Version 04 manual.

Specifically, I followed pages 277-279 to create the filter panel.

And I see the problem with my post above, you're not seeing the actual behavior. Every time I try to show it, it turns to a hyperlink.

Basically, it shows something like this:

 a href=url target=blank repeat of url 

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


WebFocus 8.2.04
WebFocus 8.2.04

November 15, 2019, 10:21 AM
NARSA
quote:
Originally posted by JulieA:
To create my reporting object and filter panel, I followed the steps outlined on pages 273-279 (Chapter 8: Enhancing Portals Using Interactive Features and Coding Techniques) of the Business Intelligence Portal Release 8.2 Version 04 manual.

Specifically, I followed pages 277-279 to create the filter panel.

And I see the problem with my post above, you're not seeing the actual behavior. Every time I try to show it, it turns to a hyperlink.

Basically, it shows something like this:

 a href=url target=blank repeat of url 



Ok.

href will not work in Excel & try to implement using below example.


-DEFAULT &WFFMT = 'HTML';

DEFINE FILE CAR
URL1/A50= IF COUNTRY EQ 'ENGLAND' THEN 'http://www.jaguarusa.com'
ELSE IF COUNTRY EQ 'JAPAN' THEN 'http://www.toyota.com'
ELSE 'http://www.ford.com';
END

TABLE FILE CAR
PRINT
URL1 NOPRINT
BY COUNTRY
BY MODEL
ON TABLE PCHOLD FORMAT &WFFMT
ON TABLE SET STYLE *
TYPE=DATA,COLUMN=N2,URL=(URL1), TARGET='_blank', $
ENDSTYLE
END


WebFOCUS 7x & 8x

November 15, 2019, 10:31 AM
JulieA
NARSA,

Thank you for the reply.

Let me try it out and see what happens.

-Julie


WebFocus 8.2.04
WebFocus 8.2.04

November 15, 2019, 10:42 AM
NARSA
quote:
Originally posted by JulieA:
NARSA,

Thank you for the reply.

Let me try it out and see what happens.

-Julie


ok.


WebFOCUS 7x & 8x

November 15, 2019, 11:21 AM
JulieA
NARSA,

Again, thank you.

My metadata already includes each and every one of the more than 80 URLs. So, I was able to use this line:

 TYPE=DATA,COLUMN=N2,URL=(URL1), TARGET='_blank', $ 


and adapt it for my needs. It works beautifully. Thank you so much!


WebFocus 8.2.04
WebFocus 8.2.04