all groups > sql server reporting services > november 2004 >
You're in the

sql server reporting services

group:

custom (dynamic) hyperlink


custom (dynamic) hyperlink JL
11/22/2004 12:09:02 PM
sql server reporting services:
I have looked through various posts, but I still don't have a solution to the
problem I have in my hand. I attempted to make create three hyperlinks from
a comma delimited string output:

value1,value2,value3

I tried the following:
="<a href='#'>" & replace(Fields!cdString,",","</a>,<a href='#'>") & "</a>"

I'm getting the string I want but it doesn't get rendered into HTML. Please
Re: custom (dynamic) hyperlink JL
11/22/2004 12:55:02 PM
wow, the response is quick. I'm so impressed. I'm trying to create <a></a>
tags in a column. And it links to a non-report web page. The string didn't
get rendered as HTML. I kept getting "<a
href='somewebpage.asp?c='123'>123</a>". Thanks again.

[quoted text, click to view]
Re: custom (dynamic) hyperlink JL
11/22/2004 2:11:01 PM
I knew I could use the "jump to url" feature. But I attempted to create the
actual html because I planned to create a VB function in "custom code" box
that would take a delimited string input parameter, for instance,
"value1,value2,value3". Then the function would transform this string into 3
different hyperlinks:

<a href="webpage.asp?c=value1">value1</a>

<a href="webpage.asp?c=value2">value2</a>
.....

And I wasn't sure if this was doable because I couldn't even create any
custom html, like <br> or <hr>, in the report designer.

[quoted text, click to view]
Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/22/2004 2:15:24 PM
Are you trying to do this from within a report and the jump to url
property? If so, then where you are getting into trouble is that you are
trying to create the html, not just the url. What you want to do is create
exactly the string that you would put into the address bar of IE. You are
not trying to create the underlying html.

Do the following. Assign the expression to a textbox on your report. You
should be able to copy and paste into IE and it should work.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/22/2004 3:41:53 PM
You are missing a concept here. You don't create tags in a column. You
create a column or use an existing one. Then do a right mouse click,
properties, extended properties, navigation, jump to url. The put in
="http://www.microsoft.com/"

as a test.

I also then set the text blue and underlined so the user knows to click on
it.

Once that is working for you then just assemble the appropriate string.
Again, you are not create html tags. You are creating a url string.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/22/2004 4:24:58 PM
Ahh, OK. I see what you are trying to accomplish. This is where the power of
expressions comes in. The jump to URL is still the way to go. You can have
any expression you want to create the URL string. This means that you can
have custom code that is doing this. So,

= code.mylinkbuilder(Parameters!whateverparameternameis.Value)

Just be sure that you return a string with the appropriate URL.

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

Re: custom (dynamic) hyperlink JL
11/22/2004 5:55:32 PM
It still doesn't solve my problem. I want function to display 2 or more
hyperlinks in a single output, according to the number of elements in the
comma delimited string. For example, if the input parameter is
"value1,value2,value3,value4", the function will return 4 different <A> html
tags. I don't think the "jump to url" can do it because it only allows one
url. I'm sorry being pain in the butt. But I have looked thru the forum and
still has no clue how to approach it. Thx again. JL

[quoted text, click to view]
Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/23/2004 9:03:30 AM
So you are trying to create a list of URLs that they would pick from? I'm
sure there is a way that this could be accomplished but you definitely need
to stop thinking about creating the html yourself. That is just not the way
that RS works. RS takes data, the report definition language (defined in
XML) and then renders it in a variety of formats. HTML is just one of the
formats.

I still might not understand what you are trying to accomplish but if it is
a list of hyperlinks you want then if you could put this in a stored
procedure where each hyperlink was in a row. Perhaps one column with a
description and the other with the hyperlink. Only the description would be
shown and then the jump to URL would use the second column.

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: custom (dynamic) hyperlink JL
11/23/2004 9:23:52 AM
Hmm...let me try this:

Here is a sample of the data:

col1 col2 col3
------------------------------------------------------------
John 713-333-5555 project1,project2,project3

I'm trying to make RS create 3 hyperlinks according to the string in "one"
row. Each hyperlink links to an asp page.

The url should look like:
http://localhost/projects/getProject.asp?name=project1

So for the second element in this string, the url would be:
http://localhost/projects/getProject.asp?name=project2

I don't want to break it into 3 rows. Is this doable in RS?


[quoted text, click to view]
Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/23/2004 12:12:24 PM
Depends. Can you count on a maximum number of projects? If so, add that many
columns. Have the source for the column be an expression that calls your
custom code where you pass it which one you want. So it would say project1
project2 etc. Leave blank if you ask for project 3 and there is no project
three. Then make it blue and underline, use the jump to url

= code.mylinkbuilder(Parameters!whateverparameternameis.Value, 1) for the
first one etc

If you set those columns to not have a border then you won't notice the
additional columns that do not have any values.

So you end up with two pieces of code, one that returns some verbiage, the
other that returns a hyperlink. The verbiage is displayed, the hyperlink is
used in the jump to url.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]
Re: custom (dynamic) hyperlink JL
11/23/2004 2:19:04 PM
The unfortunate part is the number of projects is unknown. But anyhow, is
there a way to display custom html in RS? If yes, I'm sure there is a
workaround.

[quoted text, click to view]
Re: custom (dynamic) hyperlink Bruce L-C [MVP]
11/24/2004 9:26:33 AM
No, there is no way to add custom html to RS. This has come up with people
wanting to display html they have in a database as well. If you use web
services you can do a whole lot more but it is correspondingly more
difficult too.

Given that the number of columns is not known then you have two choices that
I see. One is to modify the report rdl. This has its own difficulties,
including dealing with multi-user issues. With Version 2 with the new
controls (webform and winform) this option would be easier than it is now.
The other option is to use a matrix. Have you investigated using a matrix.
You would still need to have an expression that shows the verbiage and the
jump to URL.

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]
Re: custom (dynamic) hyperlink JL
11/25/2004 6:09:02 AM
Matrix can be an interesting solution. I know where to go from here now.
Thanks! You have been very helpful. Happy Thanksgiving.

[quoted text, click to view]
AddThis Social Bookmark Button