## jpivot (en)

JPivot Tag Library.

### Content

- chart
- chooseQuery
- clickable
- destroyQuery
- mondrianQuery
- navigator
- print
- scalarQuery
- selectproperties
- setParam
- table
- testQuery
- xmlaQuery

### chart

Body Content | JSP
Description | Creates a Chart component. This component does not produce visible output directly, it must be rendered via the WCF `render` tag.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
visible | false | boolean | true | Sets the visible property of the component. The WCF Render tag will not show a component whose visible flag is false
role | false | String | true | Name of a role, optionally prefixed by '!'. Example: role='tomcat' allows members of the role tomcat to access this component, role='!tomcat' grants access to everybody except tomcat members.
query | true | OlapModel | true | Name of the Session Attribute that contains the OLAP Data (query and result) for this tag.
baseDisplayURL | false | String | true | Base link to chart display servlet. Will be parameterized with '?filename=<temp chart image file name>'
controllerURL | false | String | true | Base link to web application controller for JPivot. Useful for complicated environments like a portal, where you would use a portlet:renderURL

### chooseQuery

Body Content | JSP
Description | chooses a query that has been previously created with a queryName attribute.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
queryName | false | String | true | name of the query to choose

#### Example

    <jp:mondrianQuery id="query01" queryName="name1">
       SELECT ...
    </jp:mondrianQuery>
    <jp:mondrianQuery id="query01" queryName="name2">
       SELECT ...
    </jp:mondrianQuery>
    ...
    <jp:chooseQuery id="query01" queryName="name1"/>

### clickable

Body Content | EMPTY
Description | Makes all members of a dimension or level clickable (i.e. generates an anchor). The generated URL contains the unique name of the member. Must be nested inside a table or query tag. The behaviour depends on the sessionParam attribute. If its present, then the parameter value will be written into the com.tonbeller.jpivot.param.SessionParamPool before the new page is shown. If its not present, the parameter will be coded into the hyperlink and must be treated in some way by the receiving page. This tag must be nested either inside a table tag or inside a query tag. Inside the table tag the clickable is available for all queries, inside the query tag its only available for that query.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
urlPattern | false | String | true | DEPRECATED - do not use in conjunction with session parameters because the browser back button does not work as expected. Use `page` attribute instead. The pattern to construct the url. If sessionParam attribute is NOT present, then "{0}" will be replaced with the unique name of the member. If urlPattern starts with "/" its relative to the application context, otherwise its absolute
page | false | String | true | Name of the target page, must start with "/". If not set the current page is re-displayed.
uniqueName | true | String | true | unique name of a dimension, hierarchy or level, whose members will be clickable
menuLabel | false | String | true | if there are multiple clickables specified, they will be displayed in a popup menu, this text will be the label for the menu entry
sessionParam | false | String | true | name of the parameter, that will be placed into the com.tonbeller.jpivot.param.SessionParamPool
propertyName | false | String | true | if present, the value of that member property will be taken for the com.tonbeller.jpivot.param.Parameter sqlValue property
propertyPrefix | false | String | true | if present, multiple SessionParam will be created, one for each member property whose name starts with propertyPrefix. The name of the SessionParam will be the name of the reminder of the member properties name after the prefix. If present, the attributes sessionParam and propertyName are not allowed.
providerClass | false | String | true | if present, an instance of this class will extract the SessionParam instances from the member. The class must implement com.tonbeller.jpivot.table.navi.ClickableMember.ParameterProvider. The attributes sessionParam, propertyName, propertyPrefix are not allowed in this case.

#### Example

    <jp:mondrianQuery ...>
      select .. from Sales
      <jp:clickable urlPattern="/otherpage.jsp?param={0}" uniqueName="[Customers]"/>
      <jp:clickable page="/yetotherpage.jsp" uniqueName="[Products].[Category]" sessionParam="Category"/>
    </jp:mondrianQuery>

### destroyQuery

Body Content | JSP
Description | destroys all queries stored with this id

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag

#### Example

    <jp:destroyQuery id="query01"/>

### mondrianQuery

Body Content | JSP
Description | Creates a session attribute that allows access to a Mondrian query, its result and navigations. The attribute is always created, if the attribute already existst it will be replaced. So one has to take care that this tag creates the attribute only if it should, e.g. by using JSTL <c:if ... > tags or similar. Its possible to use a predefined JSBC DataSource from the application server or to specify the individual JDBC parameters with this tag.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
jdbcDriver | false | String | true | Java class name of the JDBC driver
jdbcUrl | false | String | true | Connection parameters, these are database specific
jdbcUser | false | String | true | user name to connect to the database
jdbcPassword | false | String | true | password to connect to the database
dataSource | false | String | true | JNDI name of a preconfigured JDBC DataSource, e.g. jdbc/SironTDI. Must not be used with the other JDBC attributes
catalogUri | true | String | true | Path of the Mondrian schema, relative to the application context, e.g. `/WEB-INF/FoodMart.xml`
config | false | String | true | internal use only
role | false | String | true | Role from Mondrian Schema
dynResolver | false | String | true | class resolving Mondrian Schema dynamic variables
dynLocale | false | String | true | Locale for dynamic Mondrian Schema Resolver
connectionPooling | false | String | true | "false" will prevent Mondrian from Connection Pooling
dataSourceChangeListener | false | String | true | class to detect changes in datasource
queryName | false | String | true | Allows to keep multiple queries within this session attribute. For every queryName, the last query will be stored. Use chooseQuery tag to switch between queryName's or queries.
stackMode | false | boolean | true | If set to false, all queryNames are treated equally, independent of the order they are created or shown using the chooseQuery tag. If set to true it will keep the different queryName's in a stack. Example: A query with queryName `qn1` is created. Then this tag will display that query A query with queryName `qn2` is created next. Now there is a stack containing `qn1` and `qn2`. `qn2` will be the visible query. At this point, for example, if the user switches back to `qn1` using the chooseQuery tag, then `qn2` will be destroyed in stack mode. It would not be destroyed in non-stackMode. So in non-stackMode the user can arbitrary choose one of the different queries. In stackMode, if the user goes back to a previously seen query, all "younger" queries will be destroyed.

#### Example

    <jp:mondrianQuery id="query01"
      jdbcDriver="com.mysql.jdbc.Driver"
      jdbcUrl="jdbc:mysql://localhost/foodmart"
      catalogUri="/WEB-INF/test/FoodMart.xml">
    select
      {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns,
      {[Product].[All Products]} ON rows
    from Sales
    where ([Time].[1997])
    </jp:mondrianQuery>

### navigator

Body Content | JSP
Description | Creates the Navigator component. This component does not produce visible output directly, it must be rendered via the WCF `render` tag.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
query | true | OlapModel | true | Name of the Session Attribute that contains the OLAP Data (query and result) for this tag.
visible | false | boolean | true | Sets the visible property of the component. The WCF Render tag will not show a component whose visible flag is false
role | false | String | true | Name of a role, optionally prefixed by '!'. Example: role='tomcat' allows members of the role tomcat to access this component, role='!tomcat' grants access to everybody except tomcat members.

#### Example

    <jp:navigator id="navi01" query="#{query01}" visible="false"/>
    <wcf:render ref="navi01" xslUri="/WEB-INF/jpivot/navi/navigator.xsl" xslCache="true"/>

### print

Body Content | JSP
Description | Creates the Print component. This component does not produce visible output directly, you must create a WCF form to configure and call the print servlet to render to XLS/PDF

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag

### scalarQuery

Body Content | JSP
Description | Creates a session attribute that contains an OLAP result consisting of a single cell. The values are provide through tag attributes.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
value | true | String | true | EL expression evaluating to the value (number)
formattedValue | false | String | true | EL expression evaluating to the formatted value (String)
caption | false | String | true | EL expression evaluating to the caption (String)
queryName | false | String | true | see mondrianQuery
stackMode | false | boolean | true | see mondrianQuery

#### Example

    <jp:scalarQuery
      id="query01"
      value="#{some.bean.property}">
      formattedValue="#{some.bean.otherProperty}"
      caption="Some Caption" />

### selectproperties

Body Content | JSP
Description | Creates the Select Properties component, which allows to specify which properties shall be visible and in which orderd. This component does not produce visible output directly, it must be rendered via the WCF `render` tag.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
table | true | TableComponent | true | Name of the Session Attribute that contains the Table Component for this tag.
visible | false | boolean | true | Sets the visible property of the component. The WCF Render tag will not show a component whose visible flag is false
role | false | String | true | Name of a role, optionally prefixed by '!'. Example: role='tomcat' allows members of the role tomcat to access this component, role='!tomcat' grants access to everybody except tomcat members.

#### Example

    <jp:selectproperties id="selectprop01" table="#{table01}" visible="false"/>
    <wcf:render ref="selectprop01" xslUri="/WEB-INF/jpivot/navi/navigator.xsl" xslCache="true"/>

### setParam

Body Content | JSP
Description | Sets a mdx query parameter from an http parameter or from a session parameter. The body is evaluated only if the http parameter is present, so its a good place to contain a mondrian query. If you use the session Parameter, the body is never evaluated. Exactly one attribute either httpParam or sessionParam must be set.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
query | true | OlapModel | true | Name of the Session Attribute that contains the OLAP Data (query and result) for this tag.
httpParam | false | String | true | Name of a http parameter. If present, its value will be parsed and set into the mdx parameter
sessionParam | false | String | true | name of the session parameter
mdxParam | true | String | true | Name of the MDX Parameter in the query to modify

#### Example

    <jp:mondrianQuery id="query01"...>
      SELECT ... Parameter("Param01", ...)
      WHERE ...
    </jp:mondrianQuery/>

    <jp:setParam query="query01" httpParam="param" mdxParam="Param01"/>
    or
    <jp:setParam query="query01" sessionParam="CUSTOMER" mdxParam="Param01"/>

### table

Body Content | JSP
Description | Creates a Pivot Table component. This component does not produce visible output directly, it must be rendered via the WCF `render` tag.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
visible | false | boolean | true | Sets the visible property of the component. The WCF Render tag will not show a component whose visible flag is false
role | false | String | true | Name of a role, optionally prefixed by '!'. Example: role='tomcat' allows members of the role tomcat to access this component, role='!tomcat' grants access to everybody except tomcat members.
query | true | OlapModel | true | Name of the Session Attribute that contains the OLAP Data (query and result) for this tag.
configXml | false | String | true | Path for a config file that allows to add customer specific code

#### Example

    <jp:table id="table01" query="#{query01}" visible="true"/>

### testQuery

Body Content | JSP
Description | Creates test data that can be displayed by the table or chart components

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
onRows | false | String | true | Whitespace separated list of dimensions to show on rows. Possible values are: Measures, Region, Products, Advertising, Material
onColumns | false | String | true | Whitespace separated list of dimensions to show on columns. Possible values are: Measures, Region, Products, Advertising, Material

#### Example

    <jp:testQuery id="query01" onColumns="Measures" onRows="Products Region">
      for some reason, the body must not be empty
    </jp:testQuery>

### xmlaQuery

Body Content | JSP
Description | Creates a session attribute for an XMLA query. It will be used by components like table or navigator to display the result and navigate the cube. The attribute is always created, if the attribute already exists it will be replaced. So one has to take care that this tag creates the attribute only if it should, e.g. by using JSTL <c:if ... > tags or similar.

Attribute | Required | Type | rtexpr | Description
--- | --- | --- | --- | ---
id | true | String | true | Name of the Session Attribute that is created by this tag
uri | true | String | true | The URI used to access the XMLA server
dataSource | false | String | true | DataSourceInfo specification like "Provider=MSOLAP;Data Source=local"
catalog | true | String | true | Catalog spezification like "Foodmart 2000"
config | false | String | true | Path to a config file that allows to integrat customer specific code

#### Example

    <jp:xmlaQuery id="query01"
      uri="http://MYSERVER/XML4A/msxisapi.dll"
      catalog="Foodmart 2000">
    select
      {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns,
      {[Product].[All Products]} ON rows
    from Sales
    where ([Time].[1997])
    </jp:xmlaQuery>