繁体   English   中英

如何使用JAVA获取Crystal Reports参数名称

[英]How to get crystal reports parameter names with JAVA

我必须在Java App中动态创建报告。

我有一个CrystalReport(.rpt)集合,所以它取决于您选择的rpt。 选择报告时,我必须使用“ file.rpt”中重新查询的参数创建一个新窗口,因此我需要使用参数名称来确定用户应完成的参数类型。

我在论坛上找东西,但找不到任何东西。

谢谢!

尝试这个!

DatabaseController dbController = reportClientDocument.getDatabaseController();
        Tables tables = dbController.getDatabase().getTables();
        ITable table = tables.getTable(0);
        IProcedure command = (IProcedure)table;
        if(table instanceof com.crystaldecisions.sdk.occa.report.data.CommandTable) {

            for (int i=0; i< command.getParameters().size(); i++) {
                ParameterField commandParam = (ParameterField) command.getParameters().get(i);
                String paramName = commandParam.getName();
                String paramType = commandParam.getType().toString().substring(4);
                if(paramType.equalsIgnoreCase("decimal")){
                    paramType = "int";
                }
                paramType = paramType.toLowerCase();
                listOfParameter.put(paramName, paramType);
             }
            return listOfParameter;
        }
    ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();

        for(Entry<String,Object> par : parametros.entrySet()) {
            paramFieldController.setCurrentValue("", par.getKey(), par.getValue()); 
        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM