in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

Calculated URL

Last post 03-07-2008 6:28 PM by zeev shilor. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-14-2007 1:55 AM

    Calculated URL

     

    I need to create a custom list for some documents which are stored in our document repository (not sharepoint). I have 3 fields in the list - id, title and url. I can ask the user to provide id and title when he adds the item into list. However, we would like the URL to be created automatically with the form http://doc.repository.server/view?docid=id

    Here, the url is field whose value will be calculated based on the id field. I tried to create a workflow with the Sharepoint Designer to update the field value, but could not find how I can set it to be a function of another field. What is the best way to get this done? Any help will be greatly appreciated.

    Thanks,

    Ceekay

  • 09-17-2007 10:10 AM In reply to

    Re: Calculated URL

    I haven't tried concatinating strings in calculated fields, but you might be able to create a calculated field as part of the document library. I don't know if this would solve linking by itself, but if you combined this with SharePoint designer's dataview, you might be able to get the desired result.

  • 09-19-2007 4:52 PM In reply to

    • lovat
    • Top 500 Contributor
    • Joined on 06-20-2007
    • Minnesota

    Re: Calculated URL

    Actually, westdccs is very close to a good work around on this. but there is another way, if you are good at editing code, and don't mind working with Frontpage, you can edit the page in frontPage, and create a link in it's own column, and add on the parameter, using the hyperlink tool in frontpage.

    The paramaters list will allow you to add your field from the sharepoint databas to the end for the URL, thusly providing the calculated link you are looking for.

    the quick and dirty is this:

    in frontpage, add a column to your display of records.

    type the link in there http://doc.repository.server/view

    then use the Paramaters button in the hyperlink tool  to set the docid parameter to whatever field you choose.

    the result should work.

    lovat

    Lovat
    -----------------
    PHR
  • 09-21-2007 2:41 PM In reply to

    Re: Calculated URL

    Actually Westdccs had it right, you don't need front page or any programs for that matter to make this work. 

    All you have to do is create a field with the Calculated (calculation based on other columns) type selected

    call it "link" or "Your URL" (what ever you'de like) and then use this in the formula bar:

      ="http://doc.repository.server/view?docid="&[id] 

    Good luck with your customization and automation of this list.

    edited by:mjrinferno at 4:23 PM (GMT -6) on Fri, Sep 21 2007]
    Just so everyone is clear I tried this formula out and it didn't require any special settings to get the output of the two fields to be treated as a hyperlink.  Simply putting the http:// etc etc made the item "click-able"

    Do or do not... there is no try
    Web developer
    http://www.fiproductions.net
  • 09-22-2007 12:59 AM In reply to

    Re: Calculated URL

    Thanks to all of you who responded.

    I did get this much to work based on the response from Westdccs and this solution will be used in the interim. The only issue with this is that the URL is actually a long one and looks ugly. It would have been a lot nicer if I can get it to display the id as a link in this field. I am still trying to find a way to leave the column as a hyperlink instead of calculated and get this to work.

    Any ideas?

  • 12-14-2007 1:34 PM In reply to

    Re: Calculated URL

    I have a similar requirement - does anyone know how to get the calculated URL to display with a description instead of the full URL (i.e. the way a standard hyperlink field type does).

    I've tried constructing a full HREF but the sharepoint list does not render it like the standard hyperlink field type.

    Any ideas would be greatly appreciated.

     

     

  • 01-30-2008 9:05 PM In reply to

    Re: Calculated URL

    Have you considered using a 'Computed' field instead of a 'Calculated' field?  It very much depends on if you've deployed a custom list template to construct your list (using the Visual Studio extensions).  If you have then you can build a computed field whose content is dynamically rendered based on the given CAML.  You can reference other fields from within this construct.  Check out the SDK, or a simple search should help out more.

    Benefits of this are rather large, as you can render pretty much anything you would need to (such as images/hover icons/buttons etc...).  In my opinion, calculated fields are more useful as an assistance for utilising existing numeric/string/date data in simple forms etc much as you would want to do in, say, Excel with VBA functions and the like.  As soon as you venture in to the world of URLs/anything HTML then the benefits of intercepting the rendering earlier on in the process soon become apparent.

  • 03-07-2008 6:28 PM In reply to

    Re: Calculated URL

    In addition the previous suggestions of creating the calculated string in the calculated Field, make it visible in a view (i.e. All Items), you can use Sharepoint Designer to assign a friendly name to the URL.

    1. Open the site in SPD and open the page, i.e. All Items.aspx.
    2. Right Click on the Data View area and select Convert to XSLT Data View.
      You will see the string as a link.
    3. Hover the link and click on the dropdown tag to show the Data Field: and Format As: options.
    4. Select the format as Hiperlink.
      This will open the Edit Hiperlink window.
    5. Change the default Test to Display to a friendly name, i.e. Click Here or Link or Show PDF.
    6. OK the operation
    7. The friendly link should show instead of the long URL.
Page 1 of 1 (8 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.