Skip to Content
Author's profile photo Former Member

Exception when using formulas referencing fields from a table with an alias. The field name not known

I am using CRJavaHelper to display report on web but it’s not accessing alias of table.

I believe settablelocation is breaking the link so i need to use replaceconnection method instead

Can any help me with demo replaceconnection method code instead of my below current code.

try {

        String reportName = “test.rpt”;




        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

        if (clientDoc == null) {

            // Report can be opened from the relative location specified in the CRConfig.xml, or the report location

            // tag can be removed to open the reports as Java resources or using an absolute path

            // (absolute path not recommended for Web applications).

            clientDoc = new ReportClientDocument();


            // Open report

  , OpenReportOptions._openAsReadOnly);




            // ****** BEGIN SET RUNTIME DATABASE CREDENTIALS ****************


                String connectStr = PropertyLoader.getProperty(“DBURL”);

                String JNDIName = PropertyLoader.getProperty(“DB_POOL_NAME”);

                String driverName = PropertyLoader.getProperty(“DBDRIVER”);

                String userName = PropertyLoader.getProperty(“DBUSER”);    // TODO: Fill in database user

                String password = PropertyLoader.getProperty(“DBPASSWD”);    // TODO: Fill in valid password

                // Switch all tables on the main report and sub reports

                CRJavaHelper.changeDataSource(clientDoc, userName, password, connectStr, driverName, JNDIName);

                // logon to database

                CRJavaHelper.logonDataSource(clientDoc, userName, password);



Thanks in Advance.


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Got solution. we can use crjavahelper only instead of replaceconnection method. Need to create views of that alias table on database and relinked it with the report tables.

      Closing this question

      Thanks Everyone