Plands.com Logo  Business Internet Services 
Main Menu
Home
Planetary CRM
  Benefits
  Features
  Demo
E-Mail Services
  E-mail Hosting
  Newsletters
  Discussion Lists
Web Hosting
Server Co-location
and Administration
Web Applications
Technical Support
Contact Us
DXP Samples
 
DxpHome  ||   Samples  ||   Details  ||   Docs  ||   Trees  ||   xml-xsl  ||   Links
// StringMatrix.java

The StringMatrix tag contains a number of utility methods that are used to manipulate manipulate String[][] objects.

In the next example assume that a set of records was pre-ordered on a specified col (during a database query). In this case there are groups of rows that all have that same col value. The StringMatrix is used to find the index where each group begins and the number of rows in each group sequence. It also creates a new matrix that contains labels whos values come form the group col values. The resulting objects can be used to print the records using LoopSet tags. See the method colGroups() below for more info and the classes listed below to see how to print them.
@see com.plands.dxp.LoopSet
@see com.plands.dxp.LoopSetIterator

The indexes will be stored in an int[][] array of size int[n][2] array where n is the number of groups. The value of int[n][0] specifies the index where each group begins and the value of int[n][1] specifies how many succeding rows are in that group.

<dxp:StringMatrix action="colGroups" groupcol="0" store="colGroups">
   <dxp:Rs name="result1" />
</dxp:StringMatrix>

Note that the colGroups can operate on multiple MatrixParameter objects if there are multiple store paramters (comma delimited list) to specify the name each result is stored under.

You can also compute lineitem subtotals and a grand total on a single matrix. In the example below the column attribute of the MatrixParameter now contains 2 index values. The first one define the col to group by and the following value(s) indicate the cols to sum. See the method sumColGroups() for more info.

<dxp:StringMatrix action="sumColGroups" groupcol="0" sumcol="2" store="lineItems">
   <dxp:Rs name="result1"/>
</dxp:StringMatrix>

In the next example the ArrayParameter tag defines an array of colors that can be put into a matrix of records for display by a LoopSet. The alternating rows of the displaySet will have alternating color values in the new column. Multiple ArrayParameter tags can be used with a mix of hard coded and paramter values.
@see com.plands.dxp.ArrayParameter to see how the ArrayParameter tag works.

<dxp:StringMatrix action="addCol" store="displayData">
   <dxp:Rs name="records"/>
   <dxp:Cpa values="white,yellow,red"/>
</dxp:StringMatrix>

In the next example an Rp tag and a Param tag are used to add a col values to a MatrixParameter. The Rp and Param tag only return single values so every row in the col created for an Rp or Param tag will contain the same value.

<dxp:StringMatrix action="addCol" store="sqlData">
   <dxp:Rs name="queryData"/>
   <dxp:Rp name="ID"/>
   <dxp:Cp value="fixedValue"/>
</dxp:StringMatrix>


@author Mark Ashworth
@version 0.1, 2001-04-24

Return to Index

Note: We have tried to test all of the code examples but they may contain errors. Any questions, comments, suggestions, or problems should be sent to info@plands.com.