2

I've added a DVWP to a page. The DVWP shows data from a list with a multi value lookup column.

The value returned for this column is in the form: value1;value2;value3.

Now I want to render this field as links to the DispForm.aspx of the corresponding item, this is usualy done with the ID of the item. But in the data returned by the CAML-query used by the DVWP the IDs are missing from the data.

I know how to split the string on ; using recursice XSLT, that is not the problem.

How do I get the IDs of the item?

(I've seen numerous examples the other way round: people wanting to get rid of the IDs in the results using XSLT, so it must be possible to get this information)

--edit:
SharePoint Manger show this info for the column: The Column in SharePoint Manager
Notice that 'PrependId' is false. Setting this to true gives: This functionality is only available for multivalue lookup fields with ShowField other than ID.

Now I'm at a loss :(

Extra bonus: Querying this list with the U2U CAML builder (via webservices) gives a result in which the IDs are present!
List results snippet from U2U Query Builder

--edit2 PrependID is not what I'm looking for. This options toggles if the ID is rendered in front of the item in selection lists (take a look at a issue list, here the ids are shown in combination with the title) See: http://msdn.microsoft.com/en-us/library/ie/ms437580.aspx

I'm using MOSS, aka 2007.

3
  • It looks like the column in question is a Site Column. I think I've seen this before in that case where the column is a Site Column. Just for kicks, can you try adding the same type of lookup directly to the list and see if you have the same results? Commented Feb 1, 2012 at 16:07
  • I created a new Document Library in the same site. Added a column to that library (using actions -> add column). Made that column a multi lookup to the list (the newly created list, thus a self referencing list) and then in SPD I created a new DVWP on the DispForm.aspx. Same result. :(
    – Dribbel
    Commented Feb 1, 2012 at 16:35
  • I go the same problem. Am using SP2007 Designer. I have a DVWP with two lookup columns showing regular text. How do I hyperlink to DispForm?
    – butaqi
    Commented Aug 26, 2014 at 22:01

1 Answer 1

1

Just use another field, with "." added to the end of the original field name. It presents in DVWP along with the original field and includes the IDs information, exactly as it is shown in your CAML Builder screenshot.

For example, if you open the page in SharePoint Designer and select your DVWP, you will see the two fields in the Data Source Details window, like this:

enter image description here

As you see, the first field contains the formatted representation of the field contents, while field with dot at the end of its name stores the original field value.

7
  • Where does this 'dot-ending' column come from? Is it a column you added yourself (if so: how does it get populated?)
    – Dribbel
    Commented Feb 1, 2012 at 11:12
  • No I didn't add anything. This is generated by DataViewWebPart or SPDataSource, not sure exactly. I just added DVWP to my page, pointed it to my list with multiple lookup column, and got these two columns in the DataSource details window. Commented Feb 1, 2012 at 11:42
  • Note that Dribbel is using MOSS; those "dot columns" are available in 2010, but not 2007. Commented Feb 1, 2012 at 12:47
  • @MarcDAnderson, information about 2007 relation was added only 1 hour ago :) Anyway, didn't know that there are any differences between 2007 DVWP and 2010 DVWP, so thanks for pointing this out! Commented Feb 1, 2012 at 12:56
  • @omlin I had the feeling you were refering to 2010 features, so I added the 2007 info. Sorry for making you look 'bad' :)
    – Dribbel
    Commented Feb 1, 2012 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.