Hi Isomorphic, here is the code in the onmoduleload method for fetching the facets and the cubegrid:
Hope this could help.
Thanks in advance
Code:
DSRequest requestSeries = new DSRequest();
requestSeries.setOperationId("serieIngresosFetch") ;
DataSource.get("ingresos").fetchData(null, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
// TODO Auto-generated method stub
final RecordList seriesIngresos = response.getDataAsRecordList();
final Facet serie = new Facet();
serie.setId("serie");
serie.setTitle("SERIE");
FacetValue[] facetsSerie = new FacetValue[seriesIngresos.getLength()];
for (int i=0;i< seriesIngresos.getLength();i++)
{
facetsSerie[i] = new FacetValue(seriesIngresos.get(i).getAttribute("nom breSerieIngreso"), seriesIngresos.get(i).getAttribute("nombreSerieIng reso"));
}
serie.setValues(facetsSerie);
DSRequest requestOfertas = new DSRequest();
requestOfertas.setOperationId("ofertaIngresosFetch ");
DataSource.get("ingresos").fetchData(null, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
// TODO Auto-generated method stub
final RecordList ofertasIngresos = response.getDataAsRecordList();
final Facet oferta = new Facet();
oferta.setId("oferta");
oferta.setTitle("OFERTA");
FacetValue[] facetsOferta = new FacetValue[ofertasIngresos.getLength()];
for (int i=0;i< ofertasIngresos.getLength();i++)
{
facetsOferta[i] = new FacetValue(ofertasIngresos.get(i).getAttribute("ti tuloOferta"), ofertasIngresos.get(i).getAttribute("tituloOferta" ));
}
oferta.setValues(facetsOferta);
DSRequest requestMeses = new DSRequest();
requestMeses.setOperationId("mesIngresosFetch");
DataSource.get("ingresos").fetchData(null, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
// TODO Auto-generated method stub
final RecordList mesIngresos = response.getDataAsRecordList();
final Facet mes = new Facet();
mes.setId("mes");
mes.setTitle("MES");
FacetValue[] facetsMes = new FacetValue[mesIngresos.getLength()];
for (int i=0;i< mesIngresos.getLength();i++)
{
facetsMes[i] = new FacetValue(mesIngresos.get(i).getAttribute("mes"), mesIngresos.get(i).getAttribute("mes"));
}
mes.setValues(facetsMes);
if(SC.hasAnalytics())
{
final CubeGrid advancedCube = new CubeGrid();
advancedCube.setFetchOperation("ingresosFetch");
if(SC.hasDrawing()) {
advancedCube.setEnableCharting(true);
}
advancedCube.setWidth100();
advancedCube.setHeight100();
advancedCube.setFacets(serie,oferta,mes);
advancedCube.setHideEmptyFacetValues(true);
advancedCube.setShowCellContextMenus(true);
advancedCube.setRowFacets("serie","oferta");
advancedCube.setColumnFacets("mes");
advancedCube.setValueProperty("_value");
advancedCube.setDataSource(DataSource.get("ingreso s"));
advancedCube.setAutoFetchData(true);
VLOInformes.addMember(advancedCube);
}
}
},requestMeses);
}
},requestOfertas);
}
},requestSeries);
Thanks in advance
Comment