Home » Archived » BIRT » chart interactivity with dynamic parameter from source
chart interactivity with dynamic parameter from source [message #766645] |
Fri, 16 December 2011 07:22 |
darren2010 Messages: 4 Registered: December 2011 |
Junior Member |
|
|
SeriesDefinition seriesDefinition = SeriesDefinitionImpl.create();
Series series = createSeries("Bar Chart", "row[\"axisZ\"]");
series.setTranslucent(true);
series.getDataDefinition().add(QueryImpl.create("row[\"axisZ\"]"));
ActionHandle actionHandle = ModleUtil.deserializeAction((InputStream)null);
actionHandle.setLinkType(DesignChoiceConstants.ACTION_LINK_TYPE_HYPERLINK);
actionHandle.setURI("'http:\\www.yahoo.com&aa='+row[\"axisX\"]");
String sBaseUrl = ModuleUtil.serializeAction(ActionHandle);
URLValue uv = URLValueImpl.create(sBaseUrl,null,null,null,null);
seriesDefinition.getSeries().add(series);
when I run the report,I can't get the uri and dynamic parameter,when clicking
the bar,the uri,is localhost:8080/878
the 878 is dynamic parameter value,why can tell me the reason,How can I solve it?Thanks.
|
|
|
Re: chart interactivity with dynamic parameter from source [message #766930 is a reply to message #766645] |
Fri, 16 December 2011 17:15 |
|
Can you try
actionHandle.setURI("http:\\www.yahoo.com&aa="+"row[\"axisX\"]");
Jason
On 12/16/2011 2:23 AM, darren2010 wrote:
>
> SeriesDefinition seriesDefinition = SeriesDefinitionImpl.create();
> Series series = createSeries("Bar Chart", "row[\"axisZ\"]");
> series.setTranslucent(true);
> series.getDataDefinition().add(QueryImpl.create("row[\"axisZ\"]"));
>
> ActionHandle actionHandle = ModleUtil.deserializeAction((InputStream)null);
> actionHandle.setLinkType(DesignChoiceConstants.ACTION_LINK_TYPE_HYPERLINK);
> actionHandle.setURI("'http:\\www.yahoo.com&aa='+row[\"axisX\"]");
>
> String sBaseUrl = ModuleUtil.serializeAction(ActionHandle);
> URLValue uv = URLValueImpl.create(sBaseUrl,null,null,null,null);
> seriesDefinition.getSeries().add(series);
>
>
>
>
>
> when I run the report,I can't get the uri and dynamic parameter,when
> clicking the bar,the uri,is localhost:8080/878
> the 878 is dynamic parameter value,why can tell me the reason,How can I
> solve it?Thanks.
|
|
|
Re: chart interactivity with dynamic parameter from source [message #767052 is a reply to message #766930] |
Fri, 16 December 2011 23:30 |
|
This was a bit trickier than I thought. Look at the code below. Make
sure you set the BIRT version so you can use multi-url drills.
Jason
package DEAPI;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import org.eclipse.birt.chart.integrate.SimpleActionHandle;
import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.ChartWithAxes;
import org.eclipse.birt.chart.model.attribute.ActionType;
import org.eclipse.birt.chart.model.attribute.AxisType;
import org.eclipse.birt.chart.model.attribute.IntersectionType;
import org.eclipse.birt.chart.model.attribute.LegendItemType;
import org.eclipse.birt.chart.model.attribute.MultiURLValues;
import org.eclipse.birt.chart.model.attribute.Palette;
import org.eclipse.birt.chart.model.attribute.TickStyle;
import org.eclipse.birt.chart.model.attribute.TriggerCondition;
import org.eclipse.birt.chart.model.attribute.URLValue;
import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
import org.eclipse.birt.chart.model.attribute.impl.MultiURLValuesImpl;
import org.eclipse.birt.chart.model.attribute.impl.PaletteImpl;
import org.eclipse.birt.chart.model.attribute.impl.TextImpl;
import org.eclipse.birt.chart.model.attribute.impl.TooltipValueImpl;
import org.eclipse.birt.chart.model.attribute.impl.URLValueImpl;
import org.eclipse.birt.chart.model.component.Axis;
import org.eclipse.birt.chart.model.component.Label;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.model.component.impl.LabelImpl;
import org.eclipse.birt.chart.model.component.impl.SeriesImpl;
import org.eclipse.birt.chart.model.data.BaseSampleData;
import org.eclipse.birt.chart.model.data.DataFactory;
import org.eclipse.birt.chart.model.data.OrthogonalSampleData;
import org.eclipse.birt.chart.model.data.SampleData;
import org.eclipse.birt.chart.model.data.SeriesDefinition;
import org.eclipse.birt.chart.model.data.Trigger;
import org.eclipse.birt.chart.model.data.impl.ActionImpl;
import org.eclipse.birt.chart.model.data.impl.QueryImpl;
import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
import org.eclipse.birt.chart.model.data.impl.TriggerImpl;
import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl;
import org.eclipse.birt.chart.model.layout.Legend;
import org.eclipse.birt.chart.model.layout.Plot;
import org.eclipse.birt.chart.model.type.LineSeries;
import org.eclipse.birt.chart.model.type.impl.LineSeriesImpl;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.ActionHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignFileException;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.Expression;
import org.eclipse.birt.report.model.api.ExpressionType;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.ModuleUtil;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.command.ContentException;
import org.eclipse.birt.report.model.api.command.NameException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.elements.structures.Action;
import
org.eclipse.birt.report.model.api.elements.structures.PropertyBinding;
import org.eclipse.birt.report.model.parser.DesignSchemaConstants;
import com.ibm.icu.util.ULocale;
public class SimpleChart
{
private ReportDesignHandle reportDesignHandle = null;
private ElementFactory elementFactory = null;
private OdaDataSourceHandle odaDataSourceHandle = null;
private String dataSourceName = "datasource";
private String dataSetName = "maindataset";
private SessionHandle sessionHandle =null;
org.eclipse.birt.report.model.api.elements.structures.ComputedColumn
cs1, cs2, cs3 = null;
public static void main(String args[])
{
try {
new SimpleChart().createReport();
} catch (Exception e) {
e.printStackTrace();
}
}
public void createReport() throws SemanticException, IOException
{
System.out.println("Start");
init();
createMasterPages();
buildDataSource();
buildDataSet();
createBody();
// reportDesignHandle.set
reportDesignHandle.saveAs("output/desample/simplechart.rptdesign");
reportDesignHandle.close( );
// reportDesignHandle.s
Platform.shutdown();
System.out.println("Finished");
}
private void init(){
DesignConfig config = new DesignConfig( );
//config.setBIRTHome("C:/birt/birt-runtime-2_6_2/birt-runtime-2_6_2/ReportEngine");
IDesignEngine engine = null;
try {
Platform.startup(config);
IDesignEngineFactory factory = (IDesignEngineFactory) Platform
..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
engine = factory.createDesignEngine(config);
} catch (Exception ex) {
ex.printStackTrace();
}
// we need a handle of session of design engine
sessionHandle = engine.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle = sessionHandle.createDesign();
reportDesignHandle.setCreatedBy( "created by Birt3.7" );
reportDesignHandle.getModule().getVersionManager( ).setVersion(
DesignSchemaConstants.REPORT_VERSION );
elementFactory = reportDesignHandle.getElementFactory();
}
private void createMasterPages() throws ContentException, NameException
{
SimpleMasterPageHandle simpleMasterPage =
elementFactory.newSimpleMasterPage("Master Page");
reportDesignHandle.getMasterPages().add(simpleMasterPage);
}
void buildDataSource( ) throws SemanticException
{
OdaDataSourceHandle dsHandle = elementFactory.newOdaDataSource(
"Data Source", "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty( "odaDriverClass",
"org.eclipse.birt.report.data.oda.sampledb.Driver" );
dsHandle.setProperty( "odaURL", "jdbc:classicmodels:sampledb" );
dsHandle.setProperty( "odaUser", "ClassicModels" );
dsHandle.setProperty( "odaPassword", "" );
PropertyBinding pb = new PropertyBinding();
reportDesignHandle.getDataSources( ).add( dsHandle );
}
void buildDataSet( ) throws SemanticException
{
OdaDataSetHandle dsHandle = elementFactory.newOdaDataSet( dataSetName,
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
dsHandle.setDataSource( "Data Source" );
String qry = "Select PRODUCTCODE, QUANTITYORDERED from orderdetails
where ordernumber = 10104";
dsHandle.setQueryText( qry );
reportDesignHandle.getDataSets( ).add( dsHandle );
}
private void createBody() throws SemanticException
{
ExtendedItemHandle extendedItemHandle =
elementFactory.newExtendedItem("Simple Chart", "Chart");
extendedItemHandle.setWidth("700px");
extendedItemHandle.setHeight("500px");
extendedItemHandle.setProperty(ExtendedItemHandle.DATA_SET_PROP,
dataSetName);
extendedItemHandle.setProperty("outputFormat","PNG");
Chart c = createChart();
extendedItemHandle.getReportItem().setProperty(
"chart.instance", c );
reportDesignHandle.getBody().add(extendedItemHandle);
//PropertyHandle computedSet = extendedItemHandle.getColumnBindings( );
//computedSet.clearValue();
cs1 = StructureFactory.createComputedColumn( );
cs1.setName( "PRODUCTCODE" );
cs1.setExpression( "dataSetRow[\"PRODUCTCODE\"]");
cs1.setDataType( "string" );
cs1.setAggregateOn(null);
cs2 = StructureFactory.createComputedColumn( );
cs2.setName( "QUANTITYORDERED" );
cs2.setExpression( "dataSetRow[\"QUANTITYORDERED\"]");
cs2.setDataType( "integer" );
extendedItemHandle.addColumnBinding(cs1, true);
extendedItemHandle.addColumnBinding(cs2, true);
}
private Chart createChart() {
ChartWithAxes cwaLine = ChartWithAxesImpl.create();
cwaLine.setType( "Line Chart" ); //$NON-NLS-1$
cwaLine.setSubType( "Overlay" ); //$NON-NLS-1$
cwaLine.getBlock().getBounds().setWidth(600);
cwaLine.getBlock().getBounds().setHeight(400);
// Plot
cwaLine.getBlock().setBackground( ColorDefinitionImpl.WHITE() );
Plot p = cwaLine.getPlot();
p.getClientArea().setBackground( ColorDefinitionImpl.create(
255, 255,
225 ) );
// Title
cwaLine.getTitle().getLabel().getCaption().setValue("Overlay
test Line Chart" );
cwaLine.getTitle().setVisible(true);
// Legend
cwaLine.getLegend().setVisible( true );
Legend lg = cwaLine.getLegend();
lg.setItemType(LegendItemType.CATEGORIES_LITERAL);
// X-Axis
Axis xAxisPrimary = cwaLine.getPrimaryBaseAxes()[0];
xAxisPrimary.setType( AxisType.TEXT_LITERAL );
xAxisPrimary.getMajorGrid().setTickStyle(
TickStyle.BELOW_LITERAL );
xAxisPrimary.getOrigin().setType( IntersectionType.MIN_LITERAL );
// Y-Axis
Axis yAxisPrimary = cwaLine.getPrimaryOrthogonalAxis(
xAxisPrimary );
yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
yAxisPrimary.getMajorGrid().setTickStyle(
TickStyle.RIGHT_LITERAL );
yAxisPrimary.getLabel().getCaption().setValue("TEST");
yAxisPrimary.getLabel().setVisible(true);
SampleData sd = DataFactory.eINSTANCE.createSampleData( );
BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData( );
sdBase.setDataSetRepresentation( "Category-A, Category-B" );//$NON-NLS-1$
sd.getBaseSampleData( ).add( sdBase );
OrthogonalSampleData sdOrthogonal =
DataFactory.eINSTANCE.createOrthogonalSampleData( );
sdOrthogonal.setDataSetRepresentation( "4,12" );//$NON-NLS-1$
sdOrthogonal.setSeriesDefinitionIndex( 0 );
sd.getOrthogonalSampleData( ).add( sdOrthogonal );
cwaLine.setSampleData( sd );
// X-Series
Series seCategory = SeriesImpl.create( );
// seCategory.setDataSet( categoryValues );
// Set category expression.
seCategory.getDataDefinition( )
.add( QueryImpl.create( "row[\"PRODUCTCODE\"]" ) );
SeriesDefinition sdX = SeriesDefinitionImpl.create( );
Palette palx = PaletteImpl.create(10, false);
//sdY.getSeriesPalette( ).shift(1);
sdX.setSeriesPalette(palx);
//sdX.getSeriesPalette( ).shift( 1 );
//sdX.setSorting(SortOption.ASCENDING_LITERAL);
// Set default grouping.
//SeriesGrouping grouping = sdX.getGrouping( );
//grouping.getAggregateExpression();
//grouping.setEnabled( false );
//grouping.setGroupType( DataType.TEXT_LITERAL );
//grouping.setGroupingUnit( GroupingUnitType.STRING_PREFIX_LITERAL );
//grouping.setGroupingInterval( 1 );
//grouping.setAggregateExpression( "Sum" ); // Set Count aggregation.
//$NON-NLS-1$
xAxisPrimary.getSeriesDefinitions( ).add( sdX );
sdX.getSeries( ).add( seCategory );
// Y-Series
LineSeries bs1 = (LineSeries) LineSeriesImpl.create( );
bs1.getDataDefinition( ).add( QueryImpl.create(
"row[\"QUANTITYORDERED\"]" ) );
bs1.getLabel( ).setVisible( true );
try {
Action tst = StructureFactory.createAction( );
MultiURLValues muv = MultiURLValuesImpl.create( );
ActionHandle actionHandle =
ModuleUtil.deserializeAction((InputStream)null);
actionHandle.setLinkType(DesignChoiceConstants.ACTION_LINK_TYPE_HYPERLINK);
//String lnk = "row[\"hyper\"]";
String lnk = "\"http://www.google.com/#q=\"+row[\"QUANTITYORDERED\"]";
Expression myexpression = new Expression( lnk,
ExpressionType.JAVASCRIPT );
actionHandle.setExpressionProperty("uri", myexpression);
String sBaseUrl = ModuleUtil.serializeAction(actionHandle);
URLValue uv = URLValueImpl.create(sBaseUrl,null,null,null,null);
Label l = LabelImpl.create( );
l.setCaption( TextImpl.create( "www.google.com" ) );//$NON-NLS-1$
uv.setLabel( l );
muv.getURLValues( ).add( uv );
Trigger triger = TriggerImpl.create( TriggerCondition.ONCLICK_LITERAL,
ActionImpl.create( ActionType.URL_REDIRECT_LITERAL, muv ));
bs1.getTriggers( ).add( triger );
} catch (SemanticException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DesignFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SeriesDefinition sdY = SeriesDefinitionImpl.create( );
//Palette pal = PaletteImpl.create(10, false);
//sdY.getSeriesPalette( ).shift(1);
//sdY.setSeriesPalette(pal);
sdY.getGrouping().setEnabled(false);
yAxisPrimary.getSeriesDefinitions( ).add( sdY );
sdY.getSeries( ).add( bs1 );
return cwaLine;
}
}
On 12/16/2011 12:15 PM, Jason Weathersby wrote:
> Can you try
>
> actionHandle.setURI("http:\\www.yahoo.com&aa="+"row[\"axisX\"]");
>
> Jason
>
> On 12/16/2011 2:23 AM, darren2010 wrote:
>>
>> SeriesDefinition seriesDefinition = SeriesDefinitionImpl.create();
>> Series series = createSeries("Bar Chart", "row[\"axisZ\"]");
>> series.setTranslucent(true);
>> series.getDataDefinition().add(QueryImpl.create("row[\"axisZ\"]"));
>>
>> ActionHandle actionHandle =
>> ModleUtil.deserializeAction((InputStream)null);
>> actionHandle.setLinkType(DesignChoiceConstants.ACTION_LINK_TYPE_HYPERLINK);
>>
>> actionHandle.setURI("'http:\\www.yahoo.com&aa='+row[\"axisX\"]");
>>
>> String sBaseUrl = ModuleUtil.serializeAction(ActionHandle);
>> URLValue uv = URLValueImpl.create(sBaseUrl,null,null,null,null);
>> seriesDefinition.getSeries().add(series);
>>
>>
>>
>>
>>
>> when I run the report,I can't get the uri and dynamic parameter,when
>> clicking the bar,the uri,is localhost:8080/878
>> the 878 is dynamic parameter value,why can tell me the reason,How can I
>> solve it?Thanks.
>
|
|
| |
Re: chart interactivity with dynamic parameter from source [message #768123 is a reply to message #767835] |
Mon, 19 December 2011 16:05 |
|
Did you set the version like:
sessionHandle = engine.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle = sessionHandle.createDesign();
reportDesignHandle.setCreatedBy( "created by Birt 2.6.1" );
//This line is needed to support multi-urls
reportDesignHandle.getModule().getVersionManager( ).setVersion(
DesignSchemaConstants.REPORT_VERSION );
Jason
On 12/18/2011 9:54 PM, darren2010 wrote:
> Thanks Jason!
> My birt version is 2.6.1
> when using multiURLValues,there was an
> excpetion,"java.lang.ClassException:org.eclipse.birt.chart.model.attribute.impl.MultiURLValues
> cannot be cast to org.eclipse.birt.chart.model.attribute.URLValue"
>
|
|
|
Re: chart interactivity with dynamic parameter from source [message #768414 is a reply to message #768123] |
Tue, 20 December 2011 05:00 |
darren2010 Messages: 4 Registered: December 2011 |
Junior Member |
|
|
Thanks Jason!
When setting the verson,using multiURLValues run normally.But it triggers another problem.
In my application,it shows asset name,but when presssing the hyperlink,the url params is asset id,not name.I put the asset id into the dataset and scriptdataset.the code as follows:
private static ScriptDataSetHandle createScriptDataSet(ElementFactory factory, Reportlet reportlet, String reportletDataSetName, String dataSourceName) throws SemanticException {
ScriptDataSetHandle dataSet = factory.newScriptDataSet(reportletDataSetName);
dataSet.setDataSource(dataSourceName);
dataSet.setEventHandlerClass(SCRIPTED_EVENT_HANDLER);
CachedMetaData cmd = StructureFactory.createCachedMetaData();
CachedMetaDataHandle cachedMetaDataHandle = dataSet.setCachedMetaData(cmd);
int position = 0;
addDataSetColumn(dataSet, cachedMetaDataHandle, "axisX", "AxisX", "string", position++);
if(StringUtils.isNotBlank(reportlet.getAxisY())) addDataSetColumn(dataSet, cachedMetaDataHandle, "axisY", "AxisY", "string", position++);
addDataSetColumn(dataSet, cachedMetaDataHandle, "axisZ", "Count", "decimal", position++);
//here,add the id for hyperlink using.eg:addDataSetColumn(dataSet, cachedMetaDataHandle, "drill_assetId", "drill_assetId", "string", position++);
return dataSet;
}
private static void addDataSetColumn(ScriptDataSetHandle dataSet, CachedMetaDataHandle cachedMetaDataHandle, String columnName, String columnDisplayName, String columnType, int columnPosition) throws SemanticException {
ColumnHint ch = StructureFactory.createColumnHint();
ch.setProperty("columnName", columnName);
ch.setProperty("displayName", StringUtils.capitalize(columnName));
dataSet.getPropertyHandle(ScriptDataSetHandle.COLUMN_HINTS_PROP).addItem(ch);
ResultSetColumn rs = StructureFactory.createResultSetColumn();
rs.setColumnName(columnName);
rs.setPosition(columnPosition);
rs.setDataType(columnType);
PropertyHandle propertyHandle = dataSet.getPropertyHandle(ScriptDataSetHandle.RESULT_SET_PROP);
// logger.debug("rusult set properties handler: {}", propertyHandle);
propertyHandle.addItem(rs);
rs = StructureFactory.createResultSetColumn();
rs.setColumnName(columnName);
rs.setPosition(columnPosition + 1);
rs.setDataType(columnType);
cachedMetaDataHandle.getResultSet().addItem(rs);
// SimpleValueHandle svh = dataSet.getPropertyHandle(ScriptDataSetHandle.CACHED_METADATA_PROP);
// logger.debug("CACHED_METADATA_PROP value: {}", svh.getValue());
// CachedMetaDataHandle cmd = dataSet.getCachedMetaDataHandle();
// PropertyHandle crs = (PropertyHandle) cmd.getProperty("resultSet");
// logger.info("csr: {}", crs);
// crs.addItem(rs);
}
After adding the data to the dataset and the id column to the script dataset,in the hyperlink,by using row["drill_assetId"] expression,I can get the value.
berfore setting the version,I can get the assetId in the table foramt report.But now,the value is null.I am confused.
I am sorry for my poor english.
|
|
|
Re: chart interactivity with dynamic parameter from source [message #768693 is a reply to message #768414] |
Tue, 20 December 2011 16:06 |
|
I am not sure what you are doing. Can you save the rptdesign that is
created and attach it?
Jason
On 12/20/2011 12:00 AM, darren2010 wrote:
> :) Thanks Jason!
> When setting the verson,using multiURLValues run normally.But it
> triggers another problem. In my application,it shows asset name,but when
> presssing the hyperlink,the url params is asset id,not name.I put the
> asset id into the dataset and scriptdataset.the code as follows:
>
>
> private static ScriptDataSetHandle createScriptDataSet(ElementFactory
> factory, Reportlet reportlet, String reportletDataSetName, String
> dataSourceName) throws SemanticException {
> ScriptDataSetHandle dataSet =
> factory.newScriptDataSet(reportletDataSetName);
> dataSet.setDataSource(dataSourceName);
> dataSet.setEventHandlerClass(SCRIPTED_EVENT_HANDLER);
> CachedMetaData cmd = StructureFactory.createCachedMetaData();
> CachedMetaDataHandle cachedMetaDataHandle = dataSet.setCachedMetaData(cmd);
>
> int position = 0;
> addDataSetColumn(dataSet, cachedMetaDataHandle, "axisX", "AxisX",
> "string", position++);
> if(StringUtils.isNotBlank(reportlet.getAxisY()))
> addDataSetColumn(dataSet, cachedMetaDataHandle, "axisY", "AxisY",
> "string", position++);
> addDataSetColumn(dataSet, cachedMetaDataHandle, "axisZ", "Count",
> "decimal", position++);
> //here,add the id for hyperlink using.eg:addDataSetColumn(dataSet,
> cachedMetaDataHandle, "drill_assetId", "drill_assetId", "string",
> position++);
>
>
>
>
>
> return dataSet;
> }
>
> private static void addDataSetColumn(ScriptDataSetHandle dataSet,
> CachedMetaDataHandle cachedMetaDataHandle, String columnName, String
> columnDisplayName, String columnType, int columnPosition) throws
> SemanticException {
> ColumnHint ch = StructureFactory.createColumnHint();
> ch.setProperty("columnName", columnName);
> ch.setProperty("displayName", StringUtils.capitalize(columnName));
> dataSet.getPropertyHandle(ScriptDataSetHandle.COLUMN_HINTS_PROP).addItem(ch);
>
>
> ResultSetColumn rs = StructureFactory.createResultSetColumn();
> rs.setColumnName(columnName);
> rs.setPosition(columnPosition);
> rs.setDataType(columnType);
> PropertyHandle propertyHandle =
> dataSet.getPropertyHandle(ScriptDataSetHandle.RESULT_SET_PROP);
> // logger.debug("rusult set properties handler: {}", propertyHandle);
> propertyHandle.addItem(rs);
>
> rs = StructureFactory.createResultSetColumn();
> rs.setColumnName(columnName);
> rs.setPosition(columnPosition + 1);
> rs.setDataType(columnType);
> cachedMetaDataHandle.getResultSet().addItem(rs);
> // SimpleValueHandle svh =
> dataSet.getPropertyHandle(ScriptDataSetHandle.CACHED_METADATA_PROP);
> // logger.debug("CACHED_METADATA_PROP value: {}", svh.getValue());
> // CachedMetaDataHandle cmd = dataSet.getCachedMetaDataHandle();
> // PropertyHandle crs = (PropertyHandle) cmd.getProperty("resultSet");
> // logger.info("csr: {}", crs);
> // crs.addItem(rs);
> }
>
>
>
> After adding the data to the dataset and the id column to the script
> dataset,in the hyperlink,by using row["drill_assetId"] expression,I can
> get the value.
> berfore setting the version,I can get the assetId in the table foramt
> report.But now,the value is null.I am confused.
>
> I am sorry for my poor english. :(
>
|
|
| |
Goto Forum:
Current Time: Tue Apr 23 07:19:49 GMT 2024
Powered by FUDForum. Page generated in 0.03284 seconds
|