All about the Strategy, Design, Customisation, Deployment and Development of SharePoint and its related Technologies

  Administration   All Me!! Baby!!   Business   CKS   CQWP   Development   Duffer Moments   Email   Errors   Family   Fixes   General   Groove   How To   How To Code   InfoPath   IRM   Longhorn   Lotus Notes   Migration   Mobility   Office System 2007   Personal Projects   Records Management   Search Server   Security   SharePoint   Silverlight   SQL   Tech Ed 2008   Testing   Vista   VSTO   WSS   XSL

[27/09/2007] MOSS2007 – Show InfoPath fields within CQWP (Yes you can)
 
Categories: Development, Office System 2007, InfoPath, SharePoint, CQWP, XSL
 

In the last post I had been investigating if it was possible to view the fields that are created by the "Administrator Approved" InfoPath forms. After a little tip from Adri Verlaan from Microsoft, I have been able to get the columns to render. To begin one the main issue was finding the actual field names that are being used. Using CAML you are able to find these but there is another simple way of doing this. The process is quite simple. It involves creating a new style and simply getting the style to render the internal names of the fields. To do this I have created a new style shown below:

Notice that the following lines:

The above lines will simply render the internal names that are actually being presented to the CQWP. When the CQWP renders it should look as below:

What I noticed here was that the field names were actually different to the CAML query names when presented to the CQWP. One of the fields within the CAML code was:

e21843e8_x002d_cd45_x002d_4185_x002d_88a0_x002d_368251a2382c

When it was shown in the CQWP it was actually the following:

e21843e8_x005F_x002d_cd45_x005F_x002d_4185_x005F_x002d_88a0_x005F_x002d_368251a2382c

As you can see they are quite different. Now that we have the real internal names that the CQWP uses I modified the CQWP properties as shown below:

Once these changes have been made the "ItemStyle.xsl" file will also need changing to the following:

Now when we put this all together it renders as shown below (ignore the formatting – it's just a demo).

What we can do to make life easier is to use the "DataColumnRename" property of the CQWP as per a comment from Adri Verlaan from Microsoft to rename the columns to something that makes a little more sense than the long GUID type names. In a further post we will look at this. J

 
5 Comments
 

Comments

Thursday, 27 Sep 2007 08:49 by Tobias Zimmergren
Great. Just great. This on top of your previous post on the subject is really good and perfect timing for me to read ;) Thanks Liam.

Thursday, 27 Sep 2007 08:57 by Liam Cleary
Hey Tobias, Hope you are well. Glad you find it informative. Always here to help!! Have to catchup at some point soon. :-)

Friday, 12 Oct 2007 08:03 by Luc
Hi Liam, Excellent post here! good timing for me. It saves me a lot of time. Now, I'm trying to group the result by using a metadata column created in my document library. How can I configure the CQWP to group, sort or filter the content by using a metadata field defined in my library? Thanks in advance. Luc

Tuesday, 2 Sep 2008 04:18 by Joe
Well, I tried this, but my webpart only saw three of my promoted fields, and only two of them rendered any data. What happened to my other half dozen fields? The little xsl code does not list them as fields.??????

Tuesday, 2 Sep 2008 06:48 by Joe
You put your CommonViewField values on separate lines, but if I do that it prepends _x000D__x000A__x0009 to each field. I have to put them on one line. And they still don't render.

Name:

URL:

Email:

Comments: