Skip to content

Instantly share code, notes, and snippets.

View pstoellberger's full-sized avatar

Paul Stoellberger pstoellberger

View GitHub Profile
@pstoellberger
pstoellberger / Saiku 2.4 Roadmap
Created April 27, 2012 14:19
Saiku 2.4 Roadmap
New features of the query model will be:
Basically everything will be based on levels. and for each you can:
- Sort
- Filter()
- Top- / Bottom Count/Percent/Sum
- Filter by name (e.g. Quarter1, so you dont have to select 2003.Quarter1, 2004.Quarter1, ....)
- Range selections { Time.2000 : Time.2010 }
Other new stuff:
- Calculated measures in a query (no wizard, just plain mdx fragments)
@pstoellberger
pstoellberger / SaikuHttpTest
Created July 6, 2012 13:25
Using Saiku from Java via HttpClient
package org.saiku.web;
import java.net.URL;
import java.util.UUID;
import junit.framework.TestCase;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.GetMethod;
@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
@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: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: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: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 / 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,
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 {
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