I thought I would show you how you could make the CQWP list all documents in your Site Collection that are checked out to me.
The thing is, if you set the CQWP to search the whole site collection or a site for that matter, and then choose “List Type” “Document Library” you will not be able to choose the filter “Checked Out To”.
So how should we do to then?
First of all if you navigate to “Site actions” and “Manage Content and Structure” and then choose “Content and Structure Reports” you will find the reports and the CAML that is used for them. What you should do is to copy the CAML query from the report “Checked Out To Me”.
<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>
Now, add a CQWP to your page and set it to search a site of your choice, set the “List Type” to “Document Library” and give it a name, chrome type and so on, but don’t set any filters.
Now export the CQWP and open it with Notepad.
Lookup the property “QueryOverride” and replace that row with this one:
<property name="QueryOverride" type="string"><![CDATA[<Where><Eq><FieldRef Name="CheckoutUser" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value></Eq></Where>]]> </property>
As you can see I have already added the CAML from the report for you.
Now save this file somewhere and upload it to the web part gallery.
Now you have a web part you could add that will list all documents checked out to me.
You all know the great thing with InfoPath, how easy it is to work with cascading drop-downs. I would like to share one more thing with you in this area, how you could show different images depending on your choice in the drop-down.
I will very shortly describe how to set up cascading drop-downs, the main thing here is to give you the way to show the different images.
The drop-downs (2) is received from a SharePoint list with three columns “Tillverkare”, “Modell” and “Bild” (that is Manufacturer, Model and Picture, in english).
The configuration of the first drop-down looks like this.
The second drop-downs configuration looks like this.
Notice the lower circle, the next picture will show what to do when you press the button of the upper circle.
- Press the button to choose from your secondary data source
- A difference from the first drop-down is that you need to add a filter, so press the button “Filter data…”
- Add a filter where you say that Tillverkare (Main data source) is equal to Tillverkare (second data source)
Ok, so now lets move on to how to make this true for an image as well.
My list in SharePoint also has a third column called “Bild” (picture in english) and we want this picture to be changed depending on what Modell we choose.
Now lets add a Picture control to your form and open the properties of the picture.
You will see a default XPath to the picture control it self. Press the button to the right of the XPath and point to your secondary data source and your picture column. Now, as you see where the cross is, we would have wanted a button to add a filter, but it’s gone 😦
Instead we will use the filter from drop-down 2 as I will show you in a minute. For now, highlight your picture column in your data source and press OK. Also notice that you should set the picture to be Read only.
Open the properties of the second drop-down and copy the the part of the XPath that holds the filter.
[xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:Tillverkare = d:Tillverkare]
Add this at the end of the XPath for the picture control and replace “Tillverkare” with “Modell”. Now you have a filter for you picture control as well.
To avoid having to see the picture controls icon in the form when no “Modell” is choosen, put a formatting rule on it that has the condition “when Modell is blank” hide this control.
When you publish this form you will probobly get an error that looks like this.
But go ahead and publish anyway and you will see that it works.
For a full blog post about setting up the cascading drop-downs you should read this blog post at Koobar’s Point.
I hope this helps someone sometime…
I want to give you a way to filter a repeating table with the help of a drop down.
Let’s say you have a list with with a column called Requests and one column that is called Defects. You could have multiple defects for a request and now you only want to show thoose defects for the request you have choosen.
First add a data connection to receive these three columns from your list.
On your form, add a drop down and configure it like this.
Now add this secondary data source as a repeating table to your form and delete those columns you don’t need to show in the form. Deleting them from the form doesn’t mean that you delete them from the data source, they will still be there if you need them. Afterwards it could look like this.
Let us add the rule to the repeating table that will do the trick.
Highlight the repeating table and click the button Manage rules in the ribbon. Add a new Formatting rule that looks like this.
The condition says: When”Request” in the secondary data source “is not equal to” the “MainRequest” in the main data source.
Now when you test the form you will be able to see only those defects that belongs to the request you choose.