?
Solved

WSS 3.0 hyperlink in calculated column

Posted on 2010-01-11
11
Medium Priority
?
1,891 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
  • 5
  • 4
10 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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

599 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