Pentaho CDE - how to build a chart from an SQL query JDBC - postgresql

I'm trying to understand the logic of Pentaho CDE
My goal is to have a bar chart from a PostgreSQL materialized view (3 columns: geo_name, cat_name, cat_value) (I don't need to go through OLAP cubes for the moment)
So at first I define on the Layout panel one row containing one column (name: col1)
I connect to my datasource via Datasources panel like this :
Query : select * from my_schema.my_materialized_view;
Then in the Components panel, I create a 'CCC bar chart' by filling in my datasource and the HTML object correctly but I don't understand where I can define the X, Y and value columns (as in Pentaho Report Designer)?
The Listeners property does not offer me anything.
In preview I get an 'Error processing component', how do I know if my data source is connected?
Thank you !
EDIT SOLUTION
Finally it was a driver problem, we must check that the driver JDBC PostgreSQL is present here: .../tomcat/webapps/pentaho/WEB-INF/lib (in my case the driver postgresql- 9.3-1102-jdbc4.jar)
And then on Pentaho CDE, in the sql over sqljdbc data source I put 'postgresql-9.3-1102-jdbc4.jar' in the Driver property and it works!
Then you have to play with the query according to the type of chart and actually don't SELECT * FROM table

CCC charts by defaults takes first column on x axis and second column on y AXIS. Now this may be varies if you select crosstab property. If you want to change the axes as you want then you can select do it in post execution event of the ccc chart by setting properties.
Now for the data source connection, you can debug it through inspect the dashboard page and in Network you will see the cda query. also if it errors out then you can check it in console tab as well.
Another option is to check server/tomcat/logs directory you can verify pentaho.log and catlina.log for more information about the server behavior.

Related

How to display a table of results in Grafana

I have a query (using CloudWatch as a data source) that retrieves a dataset that includes a count of certain event types - fields x, y, z | stats count() by x
the result returned by the query (e.g. if I run the query in log insights):
x | count()
-------------
Foo | 16
Bar | 3
(So the aggregation of stats is run in CW Logs). I want to represent this in Grafana in the same way it is shown above, but when I use the query with a table panel, the results are populated into a drop-down selector, and the table only shows 1 row - e.g. Foo 16 and I need to select which row I want to display in the table.
What is the best way to show all results? I'm not sure whether I should be leaving the stats function off the data query and doing the aggregation / count on Grafana side, or if I am using the wrong panel type / visualation and the query is right (looking on which approach would be best here if both are possible).
thanks in advance.
I encountered this same issue with Grafana 7.0.0.
When parsing an arrayed query response using the Grafana "Table" visualization, the drop-down result selector is a feature of the v7+ versions. The Grafana Explore functions apparently use the older table visualization, which is bundled in V7 versions as "table-old". The table-old visualization should return all query results as rows in the table, without a selector.
It is also possible to click on "Inspect" and then click on the JSON tab.
remove the below field from the JSON:
"statsGroups": [
...
]
NOTE 1: it is sometimes annoying that when editing the panel it is added back automatically
UPDATE
A more clean solution (but sometimes limiting) is to use the "Merge" transformation

* coming in place of keys when connecting saiku with mongo using apache drill

I am using Apache drill in embedded mode and when I am able to connect to mongo and query in drill successfully.
However when I create a schema in saiku schema designer using driver as "org.apache.drill.jdbc.Driver" and URL as "jdbc:drill:drillbit=hostname:31010" the connection is successful and all collections are also fetched and shown as tables in saiku, but in place of column names "*" is coming and actual column names are not coming.
Dont know what I am missing on.
I figured out the solution and posting in case anyone could benefit. I had created a view in drill with select * from table. When I created view as select col1,col2... from table the issue got resolved.

QGIS no geom-columns found .. there is a genometry column

I have a database that keeps information for world map. When I export this to Quantum the map that is shown is not full. How can I solve that?
Sorry but your question is a little vague. What database are you using? How is the coordinates stored (can I assume decimal degrees, or are you using PostGIS and have a geometry column)? What geometry type are you trying to show?
If your DB is postgresql / postgis with a geom column, then you can select "Add Vector Layer" and check the "Database" radio button under "Source Type". You can then create a connection to that table and it will load the data just fine.
Alternatively, select the "Add PostGIS Layers" option and create a connection that way. You can follow the same steps if your database is MS Access etc and you can connect via ODBC.
If it doesn't then I think your issue will be in the database.
This part assumes you have point data:
If your database is excel, make sure your coordinate columns are the right data type and it is saved as .csv.
Select "Add Delimited Text Layer" in QGIS and you fill in the details for which are the X and Y coordinate columns. If you have a lot of columns it make things easier if your column headers are 'X' and 'Y' respectively.
Finally (again assuming point data) you could open the processing toolbox and search for 'Points Layer From Table'. If you don't see the processing button along the top of QGIS, then you've got to download it from the plugins manager (just search 'processing'). You need to state the layer, X field, Y field, and your CRS and that will create a new layer. NOTE the data is now separate from the database so any changes made to the layer are not reflected in the database. Unlike using PostGIS where the updates are live.
I hope this has helped, sorry if this has been a memory dump of all the ways I know without knowing a little more about your issue.

How to make my subreport access a different database than the main one?

I am evaluating JasperReports and Jaspersoft Studio for using in the company I work for and I am trying to build a report that contains information from 2 different databases.
I have 2 data adapters configured.
I've my research and found out that the only way to do so is to have either a list, table or subreport in a main report, but I still can't make it work.
I took the subreport approach, I have two reports that work separately, the main one executes this query in the sample DB
select 1 from ORDERS limit 10
The subreport runs this one in a Vertica database I own:
select 1 from my_schema.my_table limit 10
Both of them, as said, run separately.
So I go to the mainreport and add a SubReport element to the ColumnHeader band, then the wizard opens:
In the step 1 I select the subreport from the project
Second step is connection. I have these options:
Same JDBC conection
Use another connection
Use an empty data source
Use a JRDatasourceExpression
Don't use any connection.
The first and third ones are not what I want.
I tried to set the second one, but I could not find a way to select the data adapter that I have configured.
The last one doesn't work ( I get a message saying that my_schema doesn't exists, so I think that it is still trying to access the MainReport database).
Is there anyway I can make a subreport run a query in a different database/datasource from the main report?
I can summarize what I did if anyone has the same issue:
I made a proof of concept (therefore I do not have the code anymore), but I created a JRDataSource class using this tutorial and there I manually access the database and returned the rows. Then I use this as the datasource of my subreport/table.
Not as nice as I wanted, but it is possible
I guess this iReport article is also applicable to reports designed in jaspersoft studio; you just need to define the subreport connection parameter with the given expression.
Perhaps, you can ask for help from two parameters which defined in the master report by yourself. Such as:
$P{MySubreport} with type net.sf.jasperreport.engine.JasperReport;
$P{MyDatasource} with type net.sf.jasperreport.engine.JRDataSource;
Associate these two parameters to your subreport element respectively in attributes 'Expression' and 'Data Source Expression';
Please write your DataSource class that implements interface JRDataSource.
Then, in your servlet class, put your real parameter values(JasperReport for your subreport .jasper file, and your DataSource object) into a parameters Map object, and call JasperFillManager.fillReport().

Using Select query, nothing merges onto Crystal report

I have a Crystal template that I am modifying in developer because we are changing the datasource from an Access file to our Oracle DB. I created a database field that accurately connects to Oracle and added a select statement that because pulls a field from a particular table
select s.field from table s;
On the right hand side, under database fields, I see my command and can right click and browse the data, which right now returns two values.
I also made a formula field using an Azalea barcode function that calls the values (I think, this is where stuff is going wrong, I guess)
The formula field is
BarcodeC39ASCII({Command.field})
So this should take the data and format it into the barcode, except when I use print preview or print out the report, no data is merged.
I've tested this by creating a new formula field with just the Command.field, and still no data is merged. I imagine there is something really obvious that I am missing and would appreciate any input.
So unless I misunderstood your question, you are changing your datasource from Access DB to Oracle DB, correct? Assuming that the database structure remains the same then all you should need to do is go into Database -> Set Datasource Location and set the datasource location from the Access DB to the Oracle DB and your existing report should work as it did. You might have to map some fields, but that should be the extend of it. Is that what you are trying to do?
Chris