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:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT" 
                exclude-result-prefixes="sps">
  <xsl:output method="html" />

  <xsl:param name="CurrentRow" />
  
  <xsl:template match="/">
    <![CDATA[
    <script type="text/javascript">
      function combo_onchange(oSelect)
      {
      if(oSelect.selectedIndex != -1)
      {
      var selected = oSelect.options[oSelect.selectedIndex].value;
      ]]><xsl:value-of select="sps:EventJS('Select','selected')" /><![CDATA[
      }
      }
    </script>
     ]]>
    Select a value
    <select id="a1" name="combo" onchange="javascript:combo_onchange(this);" class="ms-input">
      <option value="" />
      <xsl:for-each select="Rows/Row">
        <xsl:sort select="Title" />
        <xsl:element name="option">
          <xsl:attribute name="value">
            <xsl:value-of select="_RowNumber"/>
          </xsl:attribute>
          <xsl:if test="_RowNumber=$CurrentRow">
            <xsl:attribute name ="selected" />
          </xsl:if>
          <xsl:value-of select="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>
  <DataBase ConnectionString=" ... " />
  <Query SelectCommand="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>
    <Param Name="CustomerID" Type="NChar" Default="" />
  </Filter>
</SPSActionViewConfig>

ActionViewChart XSLT

First images of ActionView and ActionViewChart webparts.

With the ActionView web part you can get data from your SQL Server Data Base and render the data using XSLT.

ActionViewChart web part permits show the data using graphs.

Both web parts are in a new package called ActionPack, that would be released at the end of June.

  • XML Configuration
<?xml version="1.0" encoding="utf-16"?>
<SPSActionViewConfig>
  <DataBase 
    ConnectionString="Data Source=W2K3;Initial Catalog=Northwind; .." />
  <Query SelectCommand=
        "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:stylesheet version="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:output method="xml" indent="yes" />
  <xsl:template match="@* | node()">
    <!-- Graph -->
    <graph caption="Title" 
           xAxisName="Products" 
           yAxisName="Sales" 
           decimalPrecision="0" 
           formatNumberScale="0">
      <xsl:apply-templates />
    </graph>
  </xsl:template>
  <!-- Each row -->
  <xsl:template match="Row">
    <!-- Put here your fields -->
    <set name="{CategoryName}" value="{Total}" color="{sps:GetFcColor()}" />
  </xsl:template>
</xsl:stylesheet>

Format vs Concat

- 1 min read

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…

public void Format()
{
    for (int i = 0; i < 1000; i++)
    {
        String.Format("{0},{1}", "Test", "Test");
    }
}
 
public void Concat()
{
    for (int i = 0; i < 1000; i++)
    {
        String.Concat("Test",",", "Test");
    }
}

Evento: Desarrollar software no es sólo picar codigo

Día y hora: jueves 15 de mayo de 18:30 a 21:00

Lugar: Centros de Excelencia Software. Salón de Actos. Polígono Industrial Mocholi, Plaza Cein. 31110 Noáin. Navarra

Unai Zorrilla Castro. Plain Concepts. Microsoft MVP Compact Framework (http://geeks.ms/blogs/unai/Default.aspx) Carlos Segura Sanz. NavarraDotNet. Microsoft MVP SharePoint Server (http://www.ideseg.com)

Agenda: 18:30 – 19:00. Reunión del grupo de usuarios navarraDotNet. Orden del día: nuestros saraos 19:00 – 21:00. Desarrollar software no es sólo picar codigo. Unai Zorrilla y Carlos Segura.

We are finishing the Cut/Copy/Paste version 2 with full version support.

Copy all versions, and maintain published versions.

Also now copied files are not overwritten by default, and if a file exist a new one is created, adding a number of copy in the name.

You can download it from Downloads section. If you are interested in a beta license key, please contact with support

MDA for Dummies

- 2 mins read

El viernes tuvimos una charla en el grupo de usuarios llamada “MDA para dummies”, en la que David Marzo de Solnatec, nos explico varias cosas sobre la arquitectura dirigida por modelos, hasta aquí, todo normal y corriente, una charla bien organizada y dada por alguien que controla, ¿Qué más se puede pedir?.

Pero lo excepcional, es que David, lleva trabajando durante años en su propio sistema MDA, sistema que permite definir modelos mediante archivos XML y ser procesados para generar código, algo similar a lo que hace CodeSmith, con la salvedad de que el modelo no parte de la Base de datos, si no que se define en un lenguaje basado en XML que el mismo ha diseñado y que pude ser extendido.

NavarraDotNet Agenda

- 2 mins read

Evento: “MDA para Dummies, continuación…”

Día: 18 de abril 2008, hora: 18:30-20:30

Lugar: Sistema Formacion. Plaza Pintor Paret, 1. 31008 Pamplona

Colaboran: Sistema Formación, Masbytes, Solnatec, navarraDotNet, MSDN

Ponente: David Marzo. Solnatec, navarraDotNet

Agenda: 18:30 – 19:00: Reunión de navarraDotNet. Orden del día: nuestros saraos 19:00 – 20:30: “MDA para Dummies, continuación…”. David Marzo. Solnatec. (http://www.solnatec.com) Demostración de uso de una herramienta MDA en el día a día de un desarrollador.