Skip to content

Instantly share code, notes, and snippets.

View pstoellberger's full-sized avatar

Paul Stoellberger pstoellberger

View GitHub Profile
For queries like:
select Measures.[Price Range] on columns,
Product.Products.Members on rows
from [Sales Cube]
.....
<CalculatedMember name="Price Range" formatString="#,##0.00 %" formula="PriceRange(Measures.Price)" dimension="Measures" visible="true">
</CalculatedMember>
public class FilterDynamicSchemaProcessor extends FilterDynamicSchemaProcessor implements DynamicSchemaProcessor {
@Override
protected String filter(String schemaUrl, PropertyList connectInfo, InputStream is) throws Exception {
String schema = super.filter(schemaUrl, connectInfo, is);
System.out.println("FilterDynamicSchemaProcessor filter() called");
String schema = super.filter(schemaUrl, connectInfo, stream);
try
{
WITH
member Time.CurrentDa as ([Time.Weekly].CurrentMember.Level.Name = "(All)")
member Measures.Now as
IIF ([Time.Weekly].CurrentMember.Level.Name = "(All)",
IIF ([Time].CurrentMember.Level.Name = "(All)",
0
, [Time].CurrentMember)
,[Time.Weekly].CurrentMember
)
member Measures.Prev as
package org.saiku;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Datestuff {
public static void main(String[] args) throws Exception {
@pstoellberger
pstoellberger / launch.jsp
Created January 30, 2013 11:35
tomcat/webapps/pentaho/mantle/launch/launch.jsp replace new analysis button with saiku if you want to keep the old "new analysis" button image remove line 209 and uncomment line 210
<%@ page pageEncoding="utf-8" %>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core'%>
<%@
page
language="java"
import="java.io.InputStream,
java.util.Map,
java.util.HashMap,
java.util.List,
java.util.ArrayList,
@pstoellberger
pstoellberger / gist:4073088
Created November 14, 2012 16:22
Setting up your local BIG QUERY SAIKU
Just copy over the jars in here into your local saiku:
saiku-server/tomcat/webapps/saiku/WEB-INF/lib
The "biq" file goes into:
saiku-server/tomcat/webapps/saiku/WEB-INF/classes/saiku-datasources
the bigquery.mondrian.xml goes into
saiku-server/tomcat/webapps/saiku/WEB-INF/classes/
@pstoellberger
pstoellberger / gist:3899805
Created October 16, 2012 14:58
Conditional Formatting in Saiku
In the mondrian schema xml:
-----------------------------------------------------------------------------------------------------------
<CalculatedMember
name="Profit"
dimension="Measures">
<Formula>[Measures].[Store Sales] - [Measures].[Store Cost]</Formula>
<CalculatedMemberProperty name="FORMAT_STRING" expression="Iif(([Measures].[Store Sales] - [Measures].[Store Cost]) &lt; 10000, '|(#,##0.00 &#8364;)|style=red', '|#,##0.00 &#8364;|style=green')"/>
<CalculatedMemberProperty name="MEMBER_ORDINAL" value="4"/>
</CalculatedMember>
@pstoellberger
pstoellberger / gist:3217340
Created July 31, 2012 14:19
Saiku Parameters (Experimental)
There is also a rudimentary parameter support in the latest saiku version.
You can find the latest version on our CI server:
plugin: http://ci.analytical-labs.com/job/saiku-plugin/
standalone: http://ci.analytical-labs.com/job/saiku-server/
You can then create a new mdx query
could be something like:
SELECT Measures.Sales on ROWS,
Organisations.[Test] on COLUMNS
@pstoellberger
pstoellberger / gist:3168655
Created July 24, 2012 07:50
Using Saiku from PHP Client
<?php
/// example by diamonddog ;)
class curl_request {
private static $opt = array(
// CURLOPT_CONNECTTIMEOUT => 20,
CURLOPT_RETURNTRANSFER => true,
@pstoellberger
pstoellberger / gist:3060153
Created July 6, 2012 13:30
Code Snippet: Using Saiku via HttpClient + Java
The following code demonstrates how to interact with the saiku webapp backend via Java.
You can check it out here: https://gist.github.com/3060118
Basically it creates a http session (important for authentication) and then executes the following steps:
1. authenticate
2. check if authentication was successful
3. fetch a query called "test.saiku"
4. post the xml of that query to the workspace
5. execute the query