Contents

Embed IcCube

Building up on the previous iccube tutorial, here are a few key extensions to reporting. First how to extract data from a command line client written

Get data using CLI (or Java)

	String url, user, password, file;

    public static void main (String... args) throws Exception {
    
        Connection connection = DriverManager.getConnection(url, user, password);

        OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
        runMDX(file, olapConnection);

        if (watch) {
            try {
                watch(file, olapConnection);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

        olapConnection.close();

    }


    public static String mdxQueryfromFile(String file) throws IOException {
        Path p = new File(file).toPath();
        System.out.println(p.toAbsolutePath());
        return Files.readString(p);
    }

    private static void runMDX(String file, OlapConnection olapConnection) throws OlapException, IOException {
        CellSet cellSet = olapConnection.createStatement().executeOlapQuery(mdxQueryfromFile(file));
        RectangularCellSetFormatter formatter = new RectangularCellSetFormatter(false);
        PrintWriter writer = new PrintWriter(System.out);
        formatter.format(cellSet, writer);
        writer.flush();
    }

Create custom measures


create MEMBER [Measures].[OneYearAgo]
 AS
 (ParallelPeriod([Year],1),[Measures].[London Mean Roadside:Nitrogen Dioxide (ug/m3)])
   
create MEMBER [Measures].[DiffOneYearAgo]
 AS
Iif( IsEmpty( [Measures].[OneYearAgo] ), 0, [Measures].[London Mean Roadside:Nitrogen Dioxide (ug/m3)] - [Measures].[OneYearAgo] )
create MEMBER [Measures].[6 Months Moving Avg] AS
    AVG([Date].[Date].CurrentMember : [Date].[Date].CurrentMember.lag(6), [Measures].[London Mean Roadside:Nitrogen Dioxide (ug/m3)])

Export/Import server side + report

Find the schemas here …

Embed report in iframe

Login is done via Le login se fera avec l’utilisateur défini dans la configuration du IcCubeFormAuthenticationServletFilter dans icCube.xml:

Enter with root

docker exec -it -u 0 icCube-nicom /bin/sh
cd /opt/icCube/bin/

    # sed me, sed me... icCube.xml
<init-param>
   <!--
       If the URL contains the ic3demo parameter, the authentication is performed
       with the user as defined by the param-value (no password is being requested).
       So here if ic3demo is in the URL, the demo user will be used.
   -->
   <param-name>ic3demo</param-name>
   <param-value>demo</param-value>
</init-param>

And add ?ic3demo= to the report URL

<div>
<iframe  width="100%" height="800" src="..report url...">
	
</iframe>
</div>