Programmatically adding chart to a report throws exception

programmatically adding chart to a report throws exception "chart condition fields are not valid".
Configuration:
I am using CR4E to create web application, I've added RAS jars (rasapp.jar, rascore.jar, reporttemplate.jar, serialization.jar) to this web application. For designing reports i am using Crystal Reports 2008.
Code:
<%
// Get the previously opened report from the session.
ReportClientDocument reportClientDocument =
     (ReportClientDocument)session.getAttribute("ReportClientDocument");
System.out.println(reportClientDocument.getReportDocument().getName());
// Try to get the report's DataDefinition object.
IDataDefinition dataDefinition;
try
     dataDefinition = reportClientDocument.getDataDefController().getDataDefinition();
// If the DataDefinition object can not be retrieved, redirect the user to an error page.
catch (Exception e)
     System.out.println("With error1");
    return;
// Create a new ChartDefinition object and set its type to ChartType.group.
ChartDefinition chartDefinition = new ChartDefinition();
chartDefinition.setChartType(ChartType.group);
Get the conditional field of the report's first group. Set this conditional
field for the ChartDefinition object using the setConditonalFields method. Notice
that the conditional field is first placed in a Fields collection because the
setConditionalFields method takes a Fields object as an argument.
Fields conditionFields = new Fields();
if (!dataDefinition.getGroups().isEmpty())
     IField field = dataDefinition.getGroups().getGroup(0).getConditionField();
     System.out.println("Condition field name ->" + field.getLongName(Locale.ENGLISH));
     conditionFields.addElement(field);
chartDefinition.setConditionFields(conditionFields);
//Get the summary field name from the form on the previous page.
String summaryFieldName = URLDecoder.decode(request.getParameter("summaryField"));
System.out.println("Summary field name ->" + summaryFieldName);
Loop through all of the report's summary fields until the one matching the name
above is found. Set this summary field for the ChartDefinition object using the
setDataFields method. Notice that the summary field is first placed in a Fields
collection because the setDataFields method takes a Fields object as an argument.
Fields dataFields = new Fields();
for (int i = 0; i < dataDefinition.getSummaryFields().size(); i++)
    IField summaryField = dataDefinition.getSummaryFields().getField(i);
     if (summaryField.getLongName(Locale.ENGLISH).equals(summaryFieldName))
          System.out.println("Adding data field ->" + summaryFieldName);
          dataFields.addElement(summaryField);
chartDefinition.setDataFields(dataFields);
Create a new ChartObject to represent the chart that will be added.  Set the
ChartDefinition property of the ChartObject using the ChartDefinition object created
above.
ChartObject chartObject = new ChartObject();
chartObject.setChartDefinition(chartDefinition);
Get the chart type, chart placement, and chart title strings from the form on the
previous page. If no chart title was chosen, create a generic title.
String chartTypeString = request.getParameter("type");
String chartPlacementString = request.getParameter("placement");
String chartTitle = request.getParameter("title");
System.out.println("chartTypeString ->"+ chartTypeString + "<-chartPlacementString->" + chartPlacementString + "<-chartTitle->"+chartTitle);
if (chartTitle.equals(""))
     chartTitle = "untitled";
Create a ChartStyleType object and a AreaSectionKind object based on the
the chartTypeString and chartPlacementString retrieved above. In this example
possible chart types are bar chart and pie chart. Possible chart placements
are header and footer.
ChartStyleType chartStyleType = ChartStyleType.from_string(chartTypeString);
AreaSectionKind chartPlacement = AreaSectionKind.from_string(chartPlacementString);
// Set the chart type, chart placement, and chart title for the chart.
chartObject.getChartStyle().setType(chartStyleType);
chartObject.setChartReportArea(chartPlacement);
chartObject.getChartStyle().getTextOptions().setTitle(chartTitle);
// Set the width, height, and top for the chart.
chartObject.setHeight(5000);
chartObject.setWidth(5000);
chartObject.setTop(1000);
Get a ReportDefController object that can be used to modify the report's definition.
ReportDefController reportDefController;
try
     reportDefController = reportClientDocument.getReportDefController();
catch (Exception e)
     System.out.println("With Error2");
     return;
*Create a Section object that represents the section that will hold the chart.
If the chart placement was set header, get the header section, otherwise, if the
chart placement was set to footer, get the footer section.
Section chartSection = null;
if (chartPlacement.equals(AreaSectionKind.reportHeader))
     IArea reportHeaderArea =
          reportDefController.getReportDefinition().getReportHeaderArea();
     chartSection = (Section)reportHeaderArea.getSections().getSection(0);
else if (chartPlacement.equals(AreaSectionKind.reportFooter))
     IArea reportFooterArea =
          reportDefController.getReportDefinition().getReportFooterArea();
     chartSection = (Section)reportFooterArea.getSections().getSection(0);
Add the chart to the section using the ReportDefController object.
reportDefController.getReportObjectController().add(chartObject, chartSection, 1);
// Save the changes and close the report.
reportClientDocument.save();
reportClientDocument.close();
session.removeAttribute("ReportClientDocument");
%>     
Trace:
com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The chart condition fields are not valid.---- Error code:-2147213287 Error code name:invalidChartObject
     at com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException.throwReportDefControllerException(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
     at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.add(Unknown Source)
     at org.apache.jsp.AddChart_jsp._jspService(AddChart_jsp.java:230)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
     at java.security.AccessController.doPrivileged(Native Method)
     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
     at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
     at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
     at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
     at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
     at java.security.AccessController.doPrivileged(Native Method)
     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
     at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
     at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:218)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
     at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
     at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
     at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
     at java.lang.Thread.run(Thread.java:595)

Please try this code snippet
var cs:ColumnSeries = new ColumnSeries();
cs.dataProvider = dp;
cs.displayName = "Series 2";
cs.yField = "values";
chart.series.push(cs);
OR
var temp:Array = [];
var cs:ColumnSeries = new ColumnSeries();
cs.dataProvider = dp;
cs.displayName = "Series 2";
cs.yField = "values";
temp = chart.series;
temp.add(cs);
chart.series = temp;

Similar Messages

  • Custom XSLT Functions Throw Exception

    Hi,
    I have following requirement-
    1. I have defined and configured some custom XSLT functions in Jdev and BPEL, which throw exception in case of an error.
    2. Now I want to catch that exception in my BPEL process
    3. In My BPEL process I have defined transformation step ( which is using those Custom XSLT functions) in a scope and added a catch branch to that
    4. But even XSLT java function throw an exception , it is not being catch by catch branch.
    Could you please help me regarding this and tell me any other way to catch an exception in BPEL process thrown by Custom XSLT function within transformation step?
    Thanks.

    Hi,
    Its the problem with the date. In the configuration file i used dateTime for java.util.Date, because of this i cant see "User Defined" option in Jdeveloper component pallete. I checked at XML data types i had seen dateTime for java.util.Date Class, but its not working.
    Do anyone created a custom xslt function which has date as parameter or return type?, If so wht they had used as data type for xml and java.
    Thanks,
    RR

  • BEA-149218 Attempted to report an exception to DRS and received an error

    I am using Weblogic81 SP2. I have two Managed servers. I am trying to
    start a managed server through Node Manager and I get the following
    error
    ####<Nov 20, 2003 10:09:14 AM EST> <Error> <Deployer> <iolaus>
    <iolaus110> <ExecuteThread: '4' for queue: 'weblogic.kernel.System'>
    <<WLS Kernel>> <> <BEA-149218> <Attempted to report an exception to DRS
    and received an error.
    NotificationException due to underlying exception
    weblogic.drs.internal.InvalidStateException: Slave update for
    DataIdentifier DataIdentfierID: 1 received a commitFailed() call - this
    can only be called if update is in AwaitingCommitCompletion state
    at
    weblogic.drs.internal.statemachines.slave.SlaveState.commitFailed(SlaveState.java:89)
    at
    weblogic.drs.internal.DataReplicationService.notifyCommitFailure(DataReplicationService.java:375)
    at
    weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:581)
    at
    weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500)
    at
    weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Does anybody know a solution or a work around please?
    Dharmesh

    Not sure if this applies to all instances, but in our case this issue was caused by an incorrect startup script for the admin node. We had neglected to include the -server flag. Adding the flag resolved the issue for us.

  • Java Does Not Throw Exception When Writing To Read-Only Files

    I have noticed that when I try to write to a read-only file in a window environment, Java does not throw an IOExcpetion, it just dosn't write to the file.
    I am writing an FTP server and here is the code:
         public static long copyStream(InputStream in, OutputStream out)throws IOException
              IOException exception = null;
              long copied = 0;
              try
                   byte buffer[] = new byte[1024];
                   int read;
                   while((read = in.read(buffer)) != -1)
                        out.write(buffer, 0, read);
                        copied += read;
              catch(IOException e)
                   //ensures that the streams are closed.
                   exception = e;
              try
                   in.close();//ensures output stream gets closed, even if there is an
                   //excption here.
              catch(IOException e){exception = e;}
              out.close();//try to close output.
              if(exception != null)
                   //exception is not null, an exception has occured.
                   //rethrow exception.
                   throw exception;
              return copied;//all ok, return bytes copied.
         }Is this a bug in JAVA VM? Is so, how should I report it?

    I have noticed that when I try to write to a read-only file in a window environment,
    Java does not throw an IOExcpetion, it just dosn't write to the file.C:\source\java\Markov>attrib readonly.out
    A R C:\source\java\Markov\readonly.out
    �C:\source\java\Markov>java b
    java.io.FileNotFoundException: readonly.out (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at b.main(b.java:5)
    import java.io.*;
    public class b {
        public static void main(String[] args) {
         try     {
              OutputStream os = new FileOutputStream ( "readonly.out");
         catch (Exception e) {
              e.printStackTrace();
    }

  • Advanced Datagrid GroupingCollection of flat data (XMLLISTCollection) while sorting throws exception

    HI,
         Iam using AdvancedDatagrid inorder to group the flat data populated from the backend through BlazeDS. Result data will be in xml format and i have converted it to xmllistcollection and assigned to the grouping collection source. Flat data is grouped by one of the attribute called 'Name' and refreshed after data has been populated.
    Data structre used as input is: WIth this structure, iam grouping by the field 'Name'.
      <Report> <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Monthly</frequency>
      <Field>Finance 1</Field>
      <Aug_10>100</Aug_10>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Yearly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>Quarterly</frequency>
      <Field>Finance 3</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>MOnthly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR4</id>
      <Name>Feeder 4</Name>
      <frequency>yearly</frequency>
      <Field>Finance 5</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    </Report>
    Grouping is done as expected. We have additional functionalities like soring / seraching of the result set. Either one is working fine. Other functionality throws excpetion mentioned below.
    When any of the advanced datagrid grid column header is clicked for sorting, it throws exception. I have pasted the exception below for reference.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.collections::HierarchicalCollectionView/internalRefresh()[C:\work\flex\dmv_automation\ projects\datavisualisation\src\mx\collections\HierarchicalCollectionView.as:709]
    at mx.collections::HierarchicalCollectionView/refresh()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\collections\HierarchicalCollectionView.as:686]
    at mx.controls::AdvancedDataGridBaseEx/sortHandler()[C:\work\flex\dmv_automation\projects\da tavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:6869]
    at mx.controls::AdvancedDataGrid/sortHandler()[C:\work\flex\dmv_automation\projects\datavisu alisation\src\mx\controls\AdvancedDataGrid.as:6899]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGrid/headerReleaseHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGrid.as:7120]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGridBaseEx/mouseUpHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:5738]
    at mx.controls::AdvancedDataGrid/mouseUpHandler()[C:\work\flex\dmv_automation\projects\datav isualisation\src\mx\controls\AdvancedDataGrid.as:8457]
    I tried with couple of options but still not able to get rid of the excpetion. I browsed through couple of links also, still not able to find an solution. Can i know whether it is a bug or it can be fixed.
    Any help / suggestions on this will be great.
    Thanks in Advance,
    Srinivasan

    Read the error messages and pay attention to the line number of the error:
    1)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile()
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:7: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        FileOutputStream f = new FileOutputStream("data.txt");
                             ^
    1 error2)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:12: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        openFile();
                ^
    1 error3)
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     try
    13     {
    14       openFile();
    15     }
    16     catch(FileNotFoundException e)
    17     {
    18       System.out.println("Error file doesn't exist.");
    19     }
    20   }
    21 }
    $ javac -cp "" Test.java
    $
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args) throws FileNotFoundException
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    $

  • Adding maps to crystal reports

    Hi,
    I have some geographic data's, I need to display those data's on a map in the crystal reports.How to add map in the crystal report and display the track points in the map, Please advice.
    Regards,
    Princy

    Here is all I have on adding a chart:
    CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
    rptClientDoc = rpt.ReportClientDocument;
    private void AddChart_Click(object sender, EventArgs e)
        //TotalUnitsByRadioTypeGraph GraphReport = new TotalUnitsByRadioTypeGraph();
        //CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rcd = GraphReport.ReportClientDocument;
        //CrystalDecisions.ReportAppServer.Controllers.ReportObjectController controller = rcd.ReportDefController.ReportObjectController;
        //CrystalDecisions.ReportAppServer.ReportDefModel.ReportObjects rptObjects = controller.GetAllReportObjects();
        //CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject chartObject;
        CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject boChartObject;
        CrystalDecisions.ReportAppServer.ReportDefModel.ChartStyle boChartStyle;
        CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
        CrystalDecisions.ReportAppServer.DataDefModel.Fields boFields;
        CrystalDecisions.ReportAppServer.DataDefModel.Field boField;
        CrystalDecisions.ReportAppServer.DataDefModel.SummaryField boSummaryField;
        int boFieldIndex;
        //rpt.Load("D:\\CPP Net\\RASXIR2Printer2K8\\rcapi_cs_add_chart\\SimpleRCAPIReport.rpt");
        //rptClientDoc = rpt.ReportClientDocument;
        boFields = rptClientDoc.DatabaseController.Database.Tables[0].DataFields;
        //Create a chart
        boChartObject = new CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject();
        //create a bar chart style
        boChartStyle = new CrystalDecisions.ReportAppServer.ReportDefModel.ChartStyle();
        boChartStyle.Type = CrystalDecisions.ReportAppServer.ReportDefModel.CrChartStyleTypeEnum.crChartStyleTypeBar;
        //CrystalDecisions.ReportAppServer.ReportDefModel.CrBarChartStyleSubtypeEnum.crBarChartStyleSubtypePercent
            //set the chart style to bar chart
        boChartObject.ChartStyle = boChartStyle;
        boChartStyle.TextOptions.Title = "Don Chart - Series Title";
        boChartStyle.TextOptions.DataTitle = "Don Chart Data Title";
        boChartStyle.TextOptions.Footnote = "footnote Title";
        //set the chart type to advanced chart
        boChartObject.ChartDefinition.ChartType = CrystalDecisions.ReportAppServer.ReportDefModel.CrChartTypeEnum.crChartTypeDetail;
        //set Customer Name field as condition field
        //get the Customer Name field
        boFieldIndex = boFields.Find("Customer Name",
            CrystalDecisions.ReportAppServer.DataDefModel.CrFieldDisplayNameTypeEnum.crFieldDisplayNameName,
            CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleUserDefault);
        boField = (CrystalDecisions.ReportAppServer.DataDefModel.Field)boFields[boFieldIndex];
        boChartObject.ChartDefinition.ConditionFields.Add(boField);
        boField = null;
        //set Last Year's Sales as data field
        //get {Customer.Last Year's Sales field}
        boFieldIndex = boFields.Find("Last Year's Sales",
            CrystalDecisions.ReportAppServer.DataDefModel.CrFieldDisplayNameTypeEnum.crFieldDisplayNameName,
            CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleUserDefault);
        boField = (CrystalDecisions.ReportAppServer.DataDefModel.Field)boFields[boFieldIndex];
        //create a Sum({Customer.Last Year's Sales})
        boSummaryField = new CrystalDecisions.ReportAppServer.DataDefModel.SummaryField();
        boSummaryField.SummarizedField = boField;
        boSummaryField.Operation = CrystalDecisions.ReportAppServer.DataDefModel.CrSummaryOperationEnum.crSummaryOperationSum;
        boSummaryField.Type = boField.Type;
        //add summary field to report client document
        rptClientDoc.DataDefController.SummaryFieldController.Add(-1, boSummaryField);
        boChartObject.ChartDefinition.DataFields.Add(boSummaryField);
        //set chart coordinates and dimensions (0, 0), width = 7 inches, height = 5 inches
        boChartObject.Left = 0;
        boChartObject.Top = 0;
        boChartObject.Width = 7 * 1440;      // 1 inch = 1440 twips
        boChartObject.Height = 5 * 1440;
        //boChartObject.ChartDefinition.ConditionFields.
        //get report header section
        boSection = rptClientDoc.ReportDefinition.ReportHeaderArea.Sections[0];
        //set chart report area to report header
        boChartObject.ChartReportArea = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindReportHeader;
        //add chart in the report header
        rptClientDoc.ReportDefController.ReportObjectController.Add(boChartObject, boSection, -1);
        MessageBox.Show("Chart Added", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);
    Don

  • Function module JOB_CLOSE throwing exception

    Hello,
    We have a batch job which has 2 steps:
    1) Step 1 uses job_open, job_submit and job_close and immediately schedules batch job A/P_ACCOUNTS which in turn creates batch input sessions A/P_ACCOUNTS.
    2) Step 2 Processes A/P_ACCOUNTS sessions created yesterday or today.
    In few cases, job_close is throwing exception job_close_failed. I believe that error is coming due to non availability of work processes. Job A/P_Accounts is defined as a class C batch job. There is a check in the FM job_close which does the following check:
    - if the class of a batch job is B or C, it calculates the number of free work processes. If there are no work processes available then JOB_CLOSE throws JOB_CLOSE_FAILED exception. 
    - If the class is u2018Au2019, it skips this check.
    We have an option of changing the class of batch job to A but there are some system critical jobs that are running as class A.
    My question is:
    In the code, JOB_CLOSE has been called for scheduling the job A/P_ACCOUNTS with parameter start immediately. Can anyone please let me know what will happen if function JOB_CLOSE is not called with start immediately option? Will the batch job A/P_ACCOUNTS wait till the time work processes are available?
    Or, can anything else be done to solve the issue?
    Regards,
    Siddharth

    HI,
    This is my experience with job_close..
    when i was working in zprograms then i was able to scedule it any time i wanted..
    but in my standard program when i tried it didn't worked....
    so i have to use that option of starting it immediately..
    and then it is working fine..
    now if i schedule 5 jobs... one after another..
    its get queued up...and once the processor is free...its working..
    my code of job close
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = job_count
          jobname              = job_name
          strtimmed            = yes " yes = 'X'
        IMPORTING
          job_was_released     = job_released
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          invalid_target       = 8
          OTHERS               = 9.
    regards,
    Yadesh

  • Creating Chart in BeX Report

    I have few questions regarding creating Chart in BW Report. One thing I need to make it clear it's a simple BeX Report not a WAD report.
    (1) How should I create a chart in the Report?? Should I have to create it in the Excel Sheet once I run the report?
    (2) Do I need to create the chart everytime manually once I run the report or is there any way we can save it and everytime we open the Report it should display the chart automatically !!
    (3) When users drill up/ drill down or group data in different views, the Chart should be dynamically changed follow the change in data set. Is it possible to do that??
    Thanks,

    hi,
    you can add a chart to your report. it is possible.check out these links for details..
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/68ce8391886e47e10000000a422035/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/38/0f3f28be7c5d47802f951c65d7a6f7/content.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a6789190-0201-0010-03be-bb1c5a65a615
    hope it helps

  • Faxing of SAPScript throwing exception

    Dear All,
    I am facing problem while sending Sales Order output through FAX. It is throwing exception in OPEN_FORM function module as FAX_NOT_VALID. I debugged and found that actually system is failing FM SX_NUMBER_TO_DEVTYPE which in turn showing that the exception has occured due to Node not found. Is it a configuaration issue? I tried to configure through SPRO but could not find any relevent place. Looking for your valuable suggestion.
    Any suggestion!
    Thanks and regards,
    Atanu

    Make sure are you entering the correct fax number in the recepient.
    Go to transaction SBWP - > create new message and try to send it as FAX. It you are not able to send fax via Business workplace then it implies that some setting is required form the BASIS.
    Otherwise the parameters passed to the OPEN_FORM needs to be investigated.

  • Using sql bulk copy throwing exception -The given value of type String from the data source cannot be converted to type int of the specified target column

    Hi All,
    I am reading notepads files and inserting data in sql tables from the notepad-
    while performing sql bulk copy on this line it throws exception - "bulkcopy.WriteToServer(dt); -"data type related(mentioned in subject )".
    Please go through my  logic and tell me what to change to avoid this error -
    public void Main()
    Dts.TaskResult = (int)ScriptResults.Success;
    string[] filePaths = Directory.GetFiles(@"C:\Users\jainruc\Desktop\Sudhanshu\master_db\Archive\test\content_insert\");
    for (int k = 0; k < filePaths.Length; k++)
    string[] lines = System.IO.File.ReadAllLines(filePaths[k]);
    //table name needs to extract after = sign
    string[] pathArr = filePaths[0].Split('\\');
    string tablename = pathArr[9].Split('.')[0];
    DataTable dt = new DataTable(tablename);
    |
    string[] arrColumns = lines[1].Split(new char[] { '|' });
    foreach (string col in arrColumns)
    dt.Columns.Add(col);
    for (int i = 2; i < lines.Length; i++)
    string[] columnsvals = lines[i].Split(new char[] { '|' });
    DataRow dr = dt.NewRow();
    for (int j = 0; j < columnsvals.Length; j++)
    //Console.Write(columnsvals[j]);
    if (string.IsNullOrEmpty(columnsvals[j]))
    dr[j] = DBNull.Value;
    else
    dr[j] = columnsvals[j];
    dt.Rows.Add(dr);
    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = "Data Source=UI3DATS009X;" + "Initial Catalog=BHI_CSP_DB;" + "User Id=sa;" + "Password=3pp$erv1ce$4";
    conn.Open();
    SqlBulkCopy bulkcopy = new SqlBulkCopy(conn);
    bulkcopy.DestinationTableName = dt.TableName;
    bulkcopy.WriteToServer(dt);
    conn.Close();
    Issue 1:-
    I am reading notepad: getting all column and values in my data table now while inserting for date and time or integer field i need to do explicit conversion how to write for specific column before bulkcopy.WriteToServer(dt);
    Issue 2:- Notepad does not contains all columns nor in specific sequence in that case i can add few column ehich i am doing now but the issue is now data table will add my columns + notepad columns and while inserting how to assign in perticular colums?
    sudhanshu sharma Do good and cast it into river :)

    Hi,
    I think you'll have to do an explicit column mapping if they are not in exact sequence in both source and destination.
    Have a look at this link:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopycolumnmapping(v=vs.110).aspx
    Good Luck!
    Kaur.
    Please mark as answer if this resolves your issue.

  • How to throw exception in run() method of Runnable?

    Hi, everyone:
    I want to know how to throw exception in run() method of interface Runnable. Since there is no throwable exception declared in run() method of interface Runnable in Java API specification.
    Thanks in advance,
    George

    Thanks, jfbriere.
    I must add though that if your run() methodis
    executed after a call to Thread.start(), then
    it is not a good choice to throw anyRuntimeException
    from the run() method.
    The reason is that the thrown exception won't be
    handled appropriately by a try-catch block.Why do you say that "the thrown exception won't be
    handled appropriately by a try-catch block"? Can you
    explain it in more detail?
    regards,
    George
    Because the other thread runs concurrently with and independently of the parent thread, there's no way you can write a try/catch that will handle the new thread's exception: try {
        myThread.start();
    catch (TheExceptionYouWantToThrowFromRun exc) {
        handle it
    do the next thing This won't work because the parent thread just continues on after myThread.start(). Start() doesn't throw the exception--run() does. And our parent thread here has lost touch with the child thread--it just moves on to "do the next thing."
    Now, you can do some exception handling with ThreadGroup and uncaughtException(), but make sure you understand why the above won't work, in case that was what you were planning to do.

  • How to change the chart color in report 6i based on its value?

    I built a simple chart using Chart Wizard in Report 6i, with X axis = supplier and Y axis = rating. I want the chart to show different color for certain rating, eg: above 80% => red color.
    Anyone know how to do this?
    Pls help!

    Hi Resham,
    In SP list, you change the background color of field value using Content editor and javascript.
    Add the content editor webpart on the list page with javascript which highlight the particualr value based on the condition.
    You can refer to following link
    http://blog.pathtosharepoint.com/2009/02/26/highlight-rows-in-sharepoint-lists/
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • PDFLPrintDoc function throw exception on Mac in PDF Lib 10

    Hi,
    Currently I'm doing the work of upgrading a xcode project on Mac from PDF lib from 8.1 to 10.
    After change to use PDF lib 10 framework, and build project, I found it throw an exception when calling function PDFLPrintDoc to print PS type, error message saying An internal error occured.
    However, on Win platform, it is ok.
    I read from release note that since PDF lib 9,  
    PDFLPrintDoc() honors only default values for tilingMode (kPDNoTiling)
    In the previous code, the  flattenInfo variable in PDPrintParams is a null porinter, so I manuall add code to set PDFlattenTilingMode to be kPDNoTiling.
    But the problem is, now when running ,it still throw exception saying "An internal error occured" , nothing changed.
    Has anybody here encountered such problem?
    Please give me an answer, thanks~

    Since this is PDFL, you have a license from either Adobe or Datalogics.  Please contact their support directly.

  • 3D pie chart in a report

    Hi all,
    I need to add a 3D pie chart in a report, and I don´t find it in the Chart Wizard. Anyone knows if is it possible to do this?
    Thanks in advance.

    Hello,
    http://www.oracle.com/technology/products/reports/htdocs/faq/Graph_FAQ_with_style.html
    How do I apply 3-D (three-dimensional) effect to my graphs?
    For Pie graph type, add the following attributes to your Graph.xml:
    <Graph ... pieDepth="30" pieTilt="20" ... >
    Regards

  • Throw exception in Java mapping and handle this in BPM

    Hi,
    I'll use a Java mapping in a BPM transform step. Is it possible to throw an exception inside this Java mapping and handle this in a BPM exception handler?
    thanks and regards
    Verena

    Hi Verena,
    In a BPM transformation step, I think you can throw exceptions only for system errors.
    Let me explain with an example, one of the ways to handle your scenario:
    Lets assume your Java Mapping fails then you can trap that exception in your Java mapping and compose an XML message which indicates that an error has occurred.
    say for e.g.
    <intermediateStructure>
    <SatusDocument>
    <StatusCode>ERROR</StatusCode>
    <ErrCode>123</ErrCode>
    <ErrDesc><!populate the thrown exception details></ErrDesc>
    </StatusDocument>
    <Payload>
    <!contains actual XML message with data>
    </Payload>
    </intermediateStructure>
    if Java mapping is Successful, you can compose the XML message as follows:
    <intermediateStructure>
    <SatusDocument>
    <StatusCode>SUCCESS</StatusCode>
    <ErrCode>0</ErrCode>
    <ErrDesc></ErrDesc>
    </StatusDocument>
    <Payload>
    <!contains actual XML message with data>
    </Payload>
    </intermediateStructure>
    You can use BPM switch operation to switch to different processing branches say for e.g. "error" branch or "success" branch by examining the value of <StatusCode> tag.
    Hope it helps !
    Regards,
    Sridhar

Maybe you are looking for

  • Share my iTunes on all my IOS devices from an external hard-drive

    I have put my full iTunes library on an external hard-drive (2TB Lacie, USB connection only). I`m doing this because my music library is geting to large now that i digitalized all my cd`s and starting to do the same for my vynil. How can I listen to

  • Different filesize after transmission with packet loss

    HI! I'm simulating packet loss on audio streams which are transferred over a network by using the JMF. I'm doing the following: read audio-WAVE file --> transcode into DVI for instance and sending --> generating packet loss --> transmitting over RTP

  • Invoke External HTTPS Web Service from OSB 11G

    Hi, We have a requirement to invoke a HTTPS web service hosted by third-party and we have to send HTTP basic authentication detials also. Third party given us the HTTP basic authentication details and only certificate nothing else. After some researc

  • Connecting to an Oracle 8i Database

    Hi Everyone, Has there been any successful ODI 11g connection (via Studio or Agent) to an Oracle 8i database? When I create a new Data Server, and select the Oracle JDBC driver in the list, I get this prompt message: Oracle JDBC Driver (Type 4 / Type

  • ADF Question: Set focus in table after ppr

    Hi all, I am using JDeveloper 10.1.3.3 with ADF and BC. In my table I have two editable fields, itemCode and quantity. When I hit enter in the itemCode, I execute a method in the backing bean, and the table is ppr refreshed. After that, I want the fo