`
soundycui
  • 浏览: 84339 次
  • 性别: Icon_minigender_2
  • 来自: 深圳
社区版块
存档分类
最新评论

Birtr的参数?ScalarParameterHandle

    博客分类:
  • birt
阅读更多
 void buildParameters() throws SemanticException
     {
          ScalarParameterHandle parameterHandle = efactory.newScalarParameter("aaaid");
          parameterHandle.setDefaultValue("1"); 
          parameterHandle.setAllowNull(true);
          parameterHandle.setAllowBlank(true);
          parameterHandle.setDataType(DesignChoiceConstants.PARAM_TYPE_INTEGER);//Integer
	  designHandle.getParameters().add(parameterHandle);
     }



创建带?的数据集
void buildDataSet() throws SemanticException
     {
    	 OdaDataSetHandle dsHandle = efactory.newOdaDataSet( "network",
		                            "org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
		 dsHandle.setDataSource( "Data Source" );
		 String qry = "Select * from test where aaaid = ?";
		 
		 dsHandle.setQueryText( qry ); 
		 designHandle.getDataSets( ).add( dsHandle ); 
		 
		 OdaDataSetParameter parameter = StructureFactory.createOdaDataSetParameter();
    	 parameter.setName("param1"); 
    	 parameter.setParamName("aaaid");
    	 parameter.setPosition(1); 
    	 parameter.setDataType("Integer");
    	 parameter.setAllowNull(true);
    	 parameter.setDefaultValue("1");
    	 parameter.setIsInput(true);
    	 parameter.setIsOutput(false); 
    	 parameter.setIsOptional(false);
		 PropertyHandle parameterHandle = dsHandle.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
		 parameterHandle.insertItem(parameter, 0); 
     }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics