Skip to Content
author's profile photo Former Member
Former Member

com.crystaldecisions.reports.formulas.FormulaException: 公式“{@-displayString-28}”的“CurrentFieldValue”处出现异常: 此处需要有一个数字或货币。

Hi,

Crystal Reports in my java a problem encountered in the development

I can not solve,like this:

I need some help,

This is what I wrote the code:

ReportClientDocument reportClientDoc = new ReportClientDocument();

reportClientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

reportClientDoc.open("WEB-INF/cca/Agent Daily.rpt",0);

//logon

DatabaseController databaseController = reportClientDoc.getDatabaseController();

ConnectionInfos connectInfos = (ConnectionInfos)databaseController.getConnectionInfos(null);

IConnectionInfo oldConnectionInfo = connectInfos.getConnectionInfo(0);

IConnectionInfo newConnectionInfo = new ConnectionInfo();

newConnectionInfo.setKind(ConnectionInfoKind.CRQE);

PropertyBag QELogonProperties = new PropertyBag();

QELogonProperties.put("DSN", "myDsn");

QELogonProperties.put("UseDSNProperties", true);

PropertyBag QEProperties = new PropertyBag();

QEProperties.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, QELogonProperties);

QEProperties.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_jdbc.dll");

QEProperties.put(PropertyBagHelper.CONNINFO_CRQE_DATABASENAME, "DMart");

QEProperties.put(PropertyBagHelper.CONNINFO_JDBC_CONNECTION_URL,"jdbc:sqlserver://127.0.0.1:1433;databasename=DMart");

QEProperties.put(PropertyBagHelper.CONNINFO_JDBC_DATABASECLASSNAME,"com.microsoft.sqlserver.jdbc.SQLServerDriver");

QEProperties.put(PropertyBagHelper.CONNINFO_SERVER_NAME,"XILEI-PC");

QEProperties.put(PropertyBagHelper.CONNINFO_SERVER_TYPE,"JDBC (JNDI)");

newConnectionInfo.setAttributes(QEProperties);

newConnectionInfo.setUserName("sa");

newConnectionInfo.setPassword("sqlgenesys");

databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo, null, DBOptions._useDefault);

ParameterFieldController paramfieldcontroller = reportClientDoc.getDataDefController().getParameterFieldController();

// Object [] multiVals = {"076,SF_Agent", "077,UK_Agent", "078,SF_Agent"};

paramfieldcontroller.setCurrentValue("", "prmAgentName", "077,UK_Agent");

ParameterFieldRangeValue newRangeVal1 = new ParameterFieldRangeValue();

newRangeVal1.setBeginValue("20120621");

newRangeVal1.setEndValue("20120626");

newRangeVal1.setLowerBoundType(RangeValueBoundType.inclusive);

newRangeVal1.setUpperBoundType(RangeValueBoundType.inclusive);

paramfieldcontroller.setCurrentValue("", "prmDate", newRangeVal1);

DataDefController dataDefController = reportClientDoc.getDataDefController();

Fields fields = dataDefController.getDataDefinition().getParameterFields();

CrystalReportViewer viewer = new CrystalReportViewer();

viewer.setParameterFields(fields);

viewer.setEnableLogonPrompt(false);

//viewer.setDatabaseLogonInfos(connInfos);

if (request.getSession().getAttribute("refreshed") == null)

{

viewer.refresh();

request.getSession().setAttribute("refreshed", "true");

}

viewer.setOwnForm(true);

viewer.setEnableParameterPrompt(false);

viewer.setPrintMode(CrPrintMode.ACTIVEX);

viewer.setReportSource(reportClientDoc.getReportSource());

request.getSession().setAttribute("viewer", viewer);

request.getSession().setAttribute("rptsource", reportClientDoc);

This is the jsp code:

<%

CrystalReportViewer viewer = (CrystalReportViewer)session.getAttribute("viewer");

ReportClientDocument reportClientDoc = (ReportClientDocument)request.getSession().getAttribute("rptsource");

viewer.processHttpRequest(request, response,this.getServletConfig().getServletContext(), null);

%>

Best regards and thanks

herray.wang

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 28, 2013 at 03:46 PM

    This is a design problem. You should make some change to the formula “{@-displayString-28}" to have a number or currency.

    I suggest you fix it in the CR Designer

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.