Included in version 2 of SPSRollUp there is a new webpart to roll up data and show it using the SharePoint calendar view.
SPSRollUpCalendar has a similar operation to the SPSRollUp and SPSRollUpChart, and this means that it tracks sites and lists collecting information, the collected data is transformed using XSLT to generate XML as SPSRollUpChart does. The result XML is a description of the events to show in a calendar view.
With SPSRollUp you can also aggregate content from Picture Libraries, this is a little sample that shows you how to do it.
Select the desired lists that you want to aggregate and add the fields in the fields list, the most important field here is the EncodedAbsThumbnailUrl, this field contains the Url where the thumbnail image is stored. Other fields that we are using in the example are Title, Description and Keywords.
A common recurrence task in SharePoint is to locate the last modified files. SPSRollUp can help to you in this task.
You can use SPSRollUp to retrieve items from a document library as it is shown in the image.
You are supposed to select in the lists the document libraries in which you want crawl the results, and, in the fields you must select:
FileRef: That is the file name with full path.
LinkFileName: That is the file name, without path.
EncodedAbsUrl: That is the full path of the file, without file name.
Modified: The date and time when the document was modified.
Created: The date and time when the document was created.
In this sample we load a DropDown list with values from a list and we will use the selected value to filter another SPSRollUp.
Select a List and a Site from which we load data, and fill the SPSRollUp properties.
Use the next XSL to render the DropDown list, (we are using the field Title in the example)
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT"exclude-result-prefixes="sps"><xsl:outputmethod="html"/><xsl:paramname="CurrentRow"/><xsl:templatematch="/"><![CDATA[
<script type="text/javascript">
function combo_onchange(oSelect)
{
if(oSelect.selectedIndex != -1)
{
var selected = oSelect.options[oSelect.selectedIndex].value;
]]><xsl:value-ofselect="sps:EventJS('Select','selected')"/><![CDATA[
}
}
</script>
]]> Select a value
<selectid="a1"name="combo"onchange="javascript:combo_onchange(this);"class="ms-input"><optionvalue=""/><xsl:for-eachselect="Rows/Row"><xsl:sortselect="Title"/><xsl:elementname="option"><xsl:attributename="value"><xsl:value-ofselect="_RowNumber"/></xsl:attribute><xsl:iftest="_RowNumber=$CurrentRow"><xsl:attributename ="selected"/></xsl:if><xsl:value-ofselect="Title"/></xsl:element></xsl:for-each></select></xsl:template></xsl:stylesheet>
This XSL render the DropDown list, generating an option for each row returned in XML. When you select an option the javascript onchange event, send all row values using the provider interface.
This is a small trick to show the entries classic list in months and years that can be found in blogs.
To produce a data input such as this one we must count the number of entries occurred in a given month and year.
This is a complex result from the point of view of an XSLT transformation, but here we will see how we can use JavaScript alongside with our transformation to produce the necessary results.
An ActionGrid connected to an ActionViewChart to show in graph form all products and your quantity ordered by a customer
ActionViewChart XML Configuration
<?xml version="1.0" encoding="utf-16"?><SPSActionViewConfig><DataBaseConnectionString=" ... "/><QuerySelectCommand="SELECT SUM([Order Details].Quantity) AS Quantity,
Products.ProductName
FROM [Order Details]
INNER JOIN Orders
ON [Order Details].OrderID = Orders.OrderID
INNER JOIN Products
ON [Order Details].ProductID = Products.ProductID
WHERE Orders.CustomerID=@CustomerID
GROUP BY Products.ProductName"/><Filter><ParamName="CustomerID"Type="NChar"Default=""/></Filter></SPSActionViewConfig>
<?xml version="1.0" encoding="utf-16"?><SPSActionViewConfig><DataBaseConnectionString="Data Source=W2K3;Initial Catalog=Northwind; .."/><QuerySelectCommand="SELECT CategoryID, CategoryName, SUM(ProductSales) AS Total
FROM [Sales by Category]
GROUP BY CategoryName, CategoryID"/></SPSActionViewConfig>
XSLT
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxsl="urn:schemas-microsoft-com:xslt"xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT"exclude-result-prefixes="msxsl sps"><xsl:outputmethod="xml"indent="yes"/><xsl:templatematch="@* | node()"><!-- Graph --><graphcaption="Title"xAxisName="Products"yAxisName="Sales"decimalPrecision="0"formatNumberScale="0"><xsl:apply-templates/></graph></xsl:template><!-- Each row --><xsl:templatematch="Row"><!-- Put here your fields --><setname="{CategoryName}"value="{Total}"color="{sps:GetFcColor()}"/></xsl:template></xsl:stylesheet>
Esto post es para recordar simplemente que concatenar cadenas con String.Format es una mala práctica y para eso tenemos ese gran olvidado que es String.Concat.
Y como muestra un ejemplo…
publicvoid Format()
{
for (int i = 0; i < 1000; i++)
{
String.Format("{0},{1}", "Test", "Test");
}
}
publicvoid Concat()
{
for (int i = 0; i < 1000; i++)
{
String.Concat("Test",",", "Test");
}
}