Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Data cube with scripted data set - Computed column "Products" has dependency cycle(Creating a cross tab with single row cell, wanted to display the data of "Products" column data in row)
Data cube with scripted data set - Computed column "Products" has dependency cycle [message #1782361] Thu, 22 February 2018 11:02
srikanth jogeswar is currently offline srikanth jogeswarFriend
Messages: 2
Registered: October 2017
Junior Member
Hi Team,

Could any one tell me what's wrong with this am unable generate a crosstab with data cube in java getting the below exception. Thank you.
=================================================
org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details:
exception.error
Error happens when create hierarchy:customerRegion.customerRegion.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
at org.eclipse.birt.report.engine.executor.ExecutorManager$ExecutorContext.executeQuery(ExecutorManager.java:457)
at org.eclipse.birt.report.item.crosstab.core.re.executor.BaseCrosstabExecutor.executeQuery(BaseCrosstabExecutor.java:122)
at org.eclipse.birt.report.item.crosstab.core.re.executor.CrosstabReportItemExecutor.execute(CrosstabReportItemExecutor.java:102)
at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:249)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:273)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:89)
at main.controller.SalesReport.runReportProcess4Xls(SalesReport.java:279)
at main.controller.SalesReport.createReport(SalesReport.java:203)
at main.controller.SalesReport.main(SalesReport.java:153)
Caused by: org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred during processing. Please see the following message for details:
exception.error
Error happens when create hierarchy:customerRegion.customerRegion.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:671)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteCube(DteDataEngine.java:233)
at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteCube(DataGenerationEngine.java:96)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:290)
at org.eclipse.birt.report.engine.executor.ExecutorManager$ExecutorContext.executeQuery(ExecutorManager.java:447)
... 17 more
Caused by: org.eclipse.birt.data.engine.core.DataException: exception.error
Error happens when create hierarchy:customerRegion.customerRegion.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
Computed column "Products" has dependency cycle.
========================================================


My Code: below
=================================================
private void createDataSources( ) throws Exception
{
ScriptDataSourceHandle dataSourceHandle = elementFactory.newScriptDataSource( "Data Source" );//$NON-NLS-1$
reportDesignHandle.getDataSources( ).add( dataSourceHandle );
}

private void createDataSets() throws Exception{
// Data Set
try{
ScriptDataSetHandle dataSetHandle;
dataSetHandle = elementFactory.newScriptDataSet( "With Data" );
dataSetHandle.setDataSource( "Data Source" );

// Set open( ) in code
dataSetHandle.setOpen( "i=0;"//$NON-NLS-1$
+ "sourcedata = new Array( new Array(3), new Array(3), new Array(3), "
+ "new Array(3), new Array(3), new Array(3), new Array(3), new Array(3));"
//+ "sourcedata[0][0] = 10; "
+ "sourcedata[0][0] = \"India\";"
+ "sourcedata[0][1] = \"Vintage Cars\";"

//+ "sourcedata[1][0] = 10; "
+ "sourcedata[1][0] = \"USA\";"
+ "sourcedata[1][1] = \"Buses\";");

// // Set fetch( ) in code
dataSetHandle.setFetch( "if ( i < 2 ){"//$NON-NLS-1$
//+ "row[\"Month\"] = sourcedata[i][0];"//$NON-NLS-1$
+ "row[\"Country\"] = sourcedata[i][0];"//$NON-NLS-1$
+ "row[\"Products\"] = sourcedata[i][1];"//$NON-NLS-1$
+ "i++;"//$NON-NLS-1$
+ "return true;}" + "else return false;" );//$NON-NLS-1$//$NON-NLS-2$
cs2 = StructureFactory.createComputedColumn( );
cs2.setName( "Products" );
cs2.setExpression( "row[\"Products\"]" );
cs2.setDataType( "string" );
ColumnHint ch = StructureFactory.createColumnHint();
ch.setProperty("columnName", "Products");

PropertyHandle computedSet = dataSetHandle.getPropertyHandle( ScriptDataSetHandle.COMPUTED_COLUMNS_PROP );
computedSet.addItem( cs2 );
reportDesignHandle.getDataSets( ).add( dataSetHandle );
}catch(Exception e){
e.printStackTrace(System.out);
}
}

public void buidCube1() throws Exception{
TabularCubeHandle cubeHandle = reportDesignHandle.getElementFactory( )
.newTabularCube( "MyCube" );
cubeHandle.setDataSet((DataSetHandle)reportDesignHandle.getDataSets().get(0));
reportDesignHandle.getCubes( ).add( cubeHandle );

// dimension
TabularDimensionHandle dimension = elementFactory.newTabularDimension(
"customerRegion");


// hierarchy
dimension.add( TabularDimensionHandle.HIERARCHIES_PROP,
elementFactory.newTabularHierarchy( "customerRegion" ),0 );
TabularHierarchyHandle hierarchy = (TabularHierarchyHandle)
dimension.getContent( TabularDimensionHandle.HIERARCHIES_PROP, 0 );
//hierarchy.setName( namePrix + hierarchy.getName( ) );
hierarchy.setDataSet( (DataSetHandle)reportDesignHandle.getDataSets().get(0) );

// level
hierarchy.add( TabularHierarchyHandle.LEVELS_PROP,
elementFactory.newTabularLevel( dimension, "customerRegion" ),0);

TabularLevelHandle level = (TabularLevelHandle) hierarchy.getLevel(0);
//TabularLevelHandle level = (TabularLevelHandle)
// hierarchy.getContent(TabularHierarchyHandle.LEVELS_PROP, 0 );
level.setName( "Products" );
level.setColumnName( "Products" );
level.setDataType( DesignChoiceConstants.COLUMN_DATA_TYPE_STRING );

//dimension.setTimeType( false );
cubeHandle.add(TabularCubeHandle.DIMENSIONS_PROP, dimension );

ExtendedItemHandle xtab =
CrosstabExtendedItemFactory.createCrosstabReportItem(reportDesignHandle,
cubeHandle, "MyCrosstab" );
CrosstabReportItemHandle xtabHandle = (CrosstabReportItemHandle) CrosstabUtil.getReportItem( xtab );
DimensionViewHandle dvh = xtabHandle.insertDimension(dimension, ICrosstabConstants.ROW_AXIS_TYPE, 0);
LevelViewHandle levelViewHandle =dvh.insertLevel(level, 0);
CrosstabCellHandle cellHandle = levelViewHandle.getCell( );
DesignElementHandle eii = xtabHandle.getModelHandle( );
// Create Product Dimension binding
ComputedColumn Products = StructureFactory.newComputedColumn(
eii, level.getName( ) );
ComputedColumnHandle bindingHandle = ((ReportItemHandle)
eii).addColumnBinding( Products,true );
Products.setName( "customerRegion/Products" );
Products.setExpression( "dimension['"+dimension.getName()+"']['"+level.getName()+"']");
Products.setDataType( "string" );
String exp = "dimension['" +dimension.getName()+"']['"+level.getName()+"']";
System.out.println(exp);
//xtab.addColumnBinding( Products, true );
DataItemHandle dataHandle = elementFactory.newDataItem("dataItem1");
dataHandle.setResultSetColumn( bindingHandle.getName( ) );
//cellHandle.addContent( dataHandle );
cellHandle.addContent( dataHandle );
reportDesignHandle.getBody().add(xtab);

}
Previous Topic:Multi data set column not work.
Next Topic:Footer with dynamic height
Goto Forum:
  


Current Time: Wed Sep 19 07:37:36 GMT 2018

Powered by FUDForum. Page generated in 0.01608 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top