?
Solved

WSS 3.0 hyperlink in calculated column

Posted on 2010-01-11
11
Medium Priority
?
1,869 Views
Last Modified: 2012-05-08
Hi,

I am trying to add a calculated column to display a hyperink but it is not displaying correctly.  

Basically what I have is a column called "REF Number" that contains an integer value.

I have another column called "REF URL" (calculated) which I want to use the value in "REF Number" (if it is not blank) as part of the URL.

What I have is:
=IF([REF Number]>0,"http://www.mysite.com/folder/view.php?id=['REF Number']")

but it is displaying the URL as:
http://www.mysite.com/folder/view.php?id=['REF Number']

How would I get it to display the number like:
http://www.mysite.com/folder/view.php?id=1234

Many Thanks,

John
0
Comment
Question by:john-formby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
11 Comments
 
LVL 10

Expert Comment

by:krunal_shah
ID: 26282414
Hi,

try like this

=IF([REF Number]>0,"http://www.mysite.com/folder/view.php?id=" + [REF Number] )
0
 
LVL 14

Author Comment

by:john-formby
ID: 26282502
Hi Krunal Shah,

I tried that but all I get is #VALUE! in the URL column.  Do you know what could be causing this?

Many Thanks,

John
0
 
LVL 10

Expert Comment

by:krunal_shah
ID: 26282551
hi,

can you please make bit more clear on this..
I tried that but all I get is #VALUE! in the URL column

and can you please provide some more details like where you are writing abive code using which language
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Author Comment

by:john-formby
ID: 26282618
Hi,

This is a List in WSS 3.0.  I have added the columns through the List Settings in WSS 3.0.

The column: REF Number is a single line of text
The column: REF URL is a calculated field with the code you posted

When I add a value to the REF Number field in my list, I get: #VALUE! displayed in the REF URL field in the list.

Hope this makes more sense.

Many Thanks,

John
0
 
LVL 10

Accepted Solution

by:
krunal_shah earned 1000 total points
ID: 26282716
Hi,

try like this,

SPList yourList= SPContext.Current.Site.RootWeb.Lists["yourList"];
                SPQuery query2 = new SPQuery();
               
                SPListItemCollection titleItems = yourList.GetItems(query2);
                SPListItem item= titleItems[0];
              strrefNum = item["REF Number"].ToString();

and use it,

=IF(strrefNum >0,"http://www.mysite.com/folder/view.php?id=" + strrefNum )
0
 
LVL 14

Author Comment

by:john-formby
ID: 26283967
Hi,

Sorry to sound stupid but where do I put that code?

Many Thanks,

John
0
 
LVL 10

Expert Comment

by:krunal_shah
ID: 26284325
Hi,

Can you please let me know where you have written this code?
=IF([REF Number]>0,"http://www.mysite.com/folder/view.php?id=['REF Number']")

given in your question
0
 
LVL 14

Author Comment

by:john-formby
ID: 26284594
Hi,

This is in:

List > Settings > List Settings

Under Columns I have added the IF Statement to the Formula textarea.

Many Thanks,

John
0
 
LVL 2

Assisted Solution

by:c-ron
c-ron earned 1000 total points
ID: 26285282
Do you have SharePoint Designer? If you create a DataView in SharePoint Designer you wouldn't need the REF URL column. You would format one of the other columns (like REF Number) as a Hyperlink that contains the URL formula.

I have not had success with Calculated URL columns directly in SharePoint.
0
 
LVL 14

Author Comment

by:john-formby
ID: 26324505
Hi c-ron,

Do you know any tutorials that explain how to do this with a DataView?  My experience with WSS is very limited.

Many Thanks,

John
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question