Crystal reports array

Hi,
I am displaying a bar chart that lists the number of months from january to december on the x-axis, but the bar chart only displays march-~> december. I am working off a pre-created report and in the code it uses an array to put the values into it. The code is as follows:
Global stringvar array groupby := ({?GroupBy});
select groupby[1]
...case 'Groupbymonth' ....
...case 'Groupbyweek'.....
...etc.
any ideas on why this is happening?
thanks
J

At the bottom of the formula field, right before it returns, insert (Basic Syntax)
dim debug as number
debug = debug / debug
This will give a divide by zero error.  When you press the OK button, the formula field will be displayed, as well as the values of all fields referenced by the formula.  See if the data is as expected.
To get the breakpoint to happen on an iteration other than the first, use
global dbgcnt as number
dim debug as number
dbgcnt = dbgcnt + 1
if dbgcnt > 100 then
  debug = debug / debug
end if
This will cause the break to happen on the 100th iteration.
Obviously, this additional logic will need to be commented out in order for the report to run to completion.
HTH,
Carl

Similar Messages

  • Mapping Arrays indexing in Crystal Reports formulas and indexes

    <span style="font-size: 10pt; font-family: &#39;Times New Roman&#39;"><p style="margin: 0in 0in 0pt" class="MsoNormal">I just took a Crystal Reports Designer class today and I presented the Array Mapping technique to the instructor. Since he was very interested I decided to post it here, so more people can benefit from it.</p>  <p style="margin: 0in 0in 0pt" class="MsoNormal">This is an idea used a lot in C++. I designed a formula using two symmetric arrays. One to hold values to be used to test a condition, and a second one to hold values to be outputted when the condition is found. Since the index in the test values array for a given value to be tested matches the index of return values array of the correspondent output value, this methodology is called index mapping.</p>  <p style="margin: 0in 0in 0pt" class="MsoNormal">Here follows the code:</p>   <p style="margin: 0in 0in 0pt" class="MsoNormal">//testValues array store values to be tested in the formula</p><p style="margin: 0in 0in 0pt" class="MsoNormal">Local StringVar Array testValues :=<span>     </span>MakeArray ( "S",<span>         </span>"M",<span>    </span><span>    </span>"L",<span>       </span>"XL");</p>  <p style="margin: 0in 0in 0pt" class="MsoNormal">//returnValues array store values to be returned by the test formula</p><p style="margin: 0in 0in 0pt" class="MsoNormal">Local StringVar Array returnValues :=<span>   </span>MakeArray ( "Small",<span>    </span>"Medial",<span>   </span>"Large",<span>  </span>"Extra Large", </p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>                                                    </span>"App Type not Found");</p><p style="margin: 0in 0in 0pt" class="MsoNormal">Local NumberVar i := 1;</p><p style="margin: 0in 0in 0pt" class="MsoNormal">Local Numbervar returnIndex := -1;</p>   <p style="margin: 0in 0in 0pt" class="MsoNormal">//Loop through the entire array for each values of the field</p><p style="margin: 0in 0in 0pt" class="MsoNormal">While<span>   </span>i <= Ubound(testValues) AND returnIndex = -1 Do(</p><p style="margin: 0in 0in 0pt" class="MsoNormal">//Actual test of the values and return bellow</p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>        </span>If ToText({CUSTOMER.SIZE}, 0) = testValues<i> Then( </p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>            </span>returnIndex := i;);</p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>      </span><span>  </span>i := i + 1;</p><p style="margin: 0in 0in 0pt" class="MsoNormal">);</p>   <p style="margin: 0in 0in 0pt" class="MsoNormal">//If any value found return it, else return last value in the return value array</p><p style="margin: 0in 0in 0pt" class="MsoNormal">If returnIndex = -1 Then</p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>    </span>returnValues[Ubound(testValues) + 1]</p><p style="margin: 0in 0in 0pt" class="MsoNormal">Else</p><p style="margin: 0in 0in 0pt" class="MsoNormal"><span>    </span>returnValues[returnIndex]</p>  <p style="margin: 0in 0in 0pt" class="MsoNormal">Fell free to email me if you have questions and enjoy the code...</p></span>

    Can you help with the below?
    Group on Client/Location, Brokerage Rate, Product
    Read all records for a particular group and store each different currency in an array
    On change of group display contents of the stored array. 
    e.g.
    Record 1         ABN   AM      FUTURE RATE AGREEMENT       0.012500%      DKK  
    Record 2         ABN   AM      FUTURE RATE AGREEMENT       0.012500%      EUR
    Record 3         ABN   AM      FUTURE RATE AGREEMENT       0.012500%      GBP
    Record 4         ABN   AM      FUTURE RATE AGREEMENT       0.012500%      USD
    On change of group I would like to display the following
                            ABN   AM      FUTURE RATE AGREEMENT       0.012500%      DKK   EUR    GBP    USD

  • Crystal Reports for Enterprise - SQL Command - Array Fetch Size

    We're attempting to migrate a report created in Crystal Reports 2013 Support Pack 3  Version 14.1.3.1257 to...
    Crystal Reports for Enterprise Version 14.1.3.1300 Build: 2013 Support Pack 3 Patch 1
    The originating report is successfully connecting and returning data from MySQL through the MySQL ODBC 3.51 Driver (3.51.30.00), using a SQL Command
    When opening up this report in CR for E and running the report against the same database and the same version of database driver, we get the following Crystal Reports error:
    Crystal Reports
    A problem was encountered
    The following error has occurred while trying to retrieve the data:
    Error on Fetch : Largevarchar and Largevarbinary data cannot retrieved as variable-length data if the array fetch size is not set to 1.
    Please check with your System Administrator that the data source is correctly configured.
    How would we check and where would we adjust the array fetch size within Crystal Report for Enterprise?
    Thank you

    Hi Vitaly,
    I had not yet tried creating a new report based on the query, within CR for E, but I did now upon your request\suggestion.  Yes, it fails as well with a brand new report..same new error as above: "Non Supported Datatype"
    I've pasted the SQL we are using below.  I just tried running this exact query natively through MyPHPAdmin, and also creating a brand new report with Crystal Reports 2013 against the same ODBC driver that I am trying to use within CR for E.  In both cases the query was accepted and ran successfully.
    Driver info:
    MySQL ODBC 3.51 Driver -  Version 3.51.30.00
    I have also tried 2 newer versions of the driver:
    MySQL ODBC 5.3 ANSI - Version 5.03.02.00
    MySQL ODBC 5.3 Unicode - Version 5.03.02.00
    ...where I also configure each within the Information Design Tool so that the "Array Fetch Size"=  1
    I receive the same "Non Supported Datatype" error for these drivers as well.  The MySQL server version is:  5.1.73-0ubuntu0.10.04.1-log
    Protocol Version: 10
    MySQL charset:  UTF-8
    Here is the query:
    SELECT ft.seq_id, ft.ticket_date, ft.posttotal,
    wl.name as current_approval_level,
    TIMESTAMPDIFF(DAY,ft.ticket_date,NOW()) AS Days_Since_TicketDate,
    TIMESTAMPDIFF(DAY,ft.date_created,NOW()) AS Days_Since_Created,
    TIMESTAMPDIFF(DAY,wph.workflow_date,NOW()) AS Days_Waiting_Your_Approval,
    ft.internal_comments
    FROM ticket AS ft
    LEFT JOIN unit AS unit ON (ft.unit_id = unit.id)
    LEFT JOIN unit_district AS udist ON (udist.unit_id = unit.id AND (udist.effective_date IS NULL OR udist.effective_date = 0 OR udist.effective_date <= ft.ticket_date)
           AND (udist.expiry_date IS NULL OR udist.expiry_date = 0 OR udist.expiry_date >= ft.ticket_date))
    LEFT JOIN workflow_document_process_map AS wdpm ON (ft.id = wdpm.document_id AND wdpm.document_type_id = 1)
    LEFT JOIN workflow_process AS wp ON (wp.id = wdpm.workflow_process_id)
    LEFT JOIN workflow_rule AS wr ON (wp.workflow_schema_id = wr.workflow_schema_id AND wp.workflow_level_id = wr.workflow_level_id AND wr.workflow_activity_id = 2  AND (wr.effective_date IS NULL OR wr.effective_date = 0 OR wr.effective_date <= ft.ticket_date) AND (wr.expiry_date IS NULL OR wr.expiry_date = 0 OR wr.expiry_date >= ft.ticket_date))
    LEFT JOIN workflow_rule AS wr2 ON (wp.workflow_schema_id = wr2.workflow_schema_id AND wp.workflow_level_id = wr2.workflow_level_id AND wr2.workflow_activity_id = 4 AND (wr2.effective_date IS NULL OR wr2.effective_date = 0 OR wr2.effective_date <= ft.ticket_date) AND (wr2.expiry_date IS NULL OR wr2.expiry_date = 0 OR wr2.expiry_date >= ft.ticket_date))
    LEFT JOIN workflow_process_history AS wph ON (wph.workflow_process_id = wp.id)
    LEFT JOIN ticket_attachment AS ftattach ON (ft.id = ftattach.ticket_id AND ftattach.attachment_type_id = 2)
    LEFT JOIN person AS p ON (ft.supervisor_id = p.id)
    LEFT JOIN person AS p2 ON (ft.head_office_contact_id = p2.id AND (p2.effective_date IS NULL OR p2.effective_date = 0 OR p2.effective_date <= ft.ticket_date)
           AND (p2.expiry_date IS NULL OR p2.expiry_date = 0 OR p2.expiry_date >= ft.ticket_date))
    LEFT JOIN person AS p3 ON (ft.sales_person_id = p3.id)
    LEFT JOIN person_company_sales AS pcs ON (p2.id = pcs.client_person_id AND pcs.company_id = ft.client_company_id)
    LEFT JOIN person AS p4 ON (ft.created_by = p4.id)
    LEFT JOIN person AS p5 ON (ft.well_site_supervisor_id = p5.id)
    LEFT JOIN division AS d ON (ft.division_id = d.id)
    LEFT JOIN district AS dist1 ON (ft.district_id = dist1.id)
    LEFT JOIN district AS dist2 ON (udist.district_id = dist2.id)
    LEFT JOIN company AS c ON (ft.client_company_id = c.id)
    LEFT JOIN province AS prov ON (ft.job_province_id = prov.id)
    LEFT JOIN ticket_attachment AS ftattach2 ON (ft.id = ftattach2.ticket_id AND ftattach2.attachment_type_id != 2)
    LEFT JOIN locale_currency AS lc ON (lc.id = ft.locale_currency_id)
    LEFT JOIN operation_type AS ot ON (ot.id = ft.operation_type_id)
    LEFT JOIN incident AS i ON (i.ticket_id = ft.id)
    LEFT JOIN invoice_type AS it ON (it.id = ft.invoice_type_id)
    LEFT JOIN workflow_level AS wl ON (wl.id = wp.workflow_level_id)
    LEFT JOIN company AS dist1_company ON (dist1_company.id = dist1.internal_company_id)
    WHERE 1
    AND ( pcs.sales_person_id = 2113 AND pcs.effective_date <= ft.ticket_date AND ( pcs.expiry_date >= ft.ticket_date OR pcs.expiry_date = '0000-00-00 00:00:00' OR pcs.expiry_date IS NULL) )
    AND ft.closed_flag <> 1 AND (wr2.id IS NOT NULL OR wr2.id != 0)
    AND ft.commit_flag = 1
    AND ft.dispatch_status = 0
    AND dist1_company.country_id = 1
    AND wr2.role_id = 2
    GROUP BY ft.id
    ORDER BY ticket_date ASC, ft.id ASC
    Thanks you for your help.

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Purchase Order Crystal Report Layout Error

    The stock Crystal Report Layout for Purchase Orders is giving me the following error:
    A subscript must be between 1 and the size of the array.
    Details: errorKind
    Error in File POR20002 {b89f97ad-bf1f-447b-8bb4-b3d2e5219269}
    {3C375C81-7D37-475D-9BCB-1703CE533B65}.rpt
    Error in formula N_Decimal_Places:
    '// To get the length of decimals
    A subscript must be between 1 and the size of the array.
    Details: errorKind
    I looked in the Crystal Reports Formula fields and could not find N_Decimal_Places.
    Has any one else had the problem with the PO layout that comes with Business One?  If so, how did you fix it?

    Couldn't find how to copy the PO layout over using copy express.
    I did compare the RDOC fields for POR20002 in both databases and they are Identical. 
    In Crystal Reports, I did a formula search for N_Decimal_Places and it found nothing.  Then I did a search for 'length' in all formulas and it finds length in N_Decimal_Places.  When I double click on N_Decimal_Places it clears the screen and never shows the formula. This happens in both layouts for my test database and SBODemoUS.
    Again, SBODemoUS works correctly and AAA_TEST give the error.

  • Dynamic crystal report generation - issues with column headings

    Hi All,<br>
    I'm trying to generate a crystal report dynamically based on a "result set" data(Query: select REPORT_ID, REPORT_NAME, REPORT_DESC, RPT_FILE_NAME, LOCATION from IRS_REPORT_DETAILS). I'm able to generate the report run time, But the report is without columns heads. I would like to include the column headings as well. <br><br>
    I searched the API(RAS) and found that there is a 'add(java.lang.String fieldName, java.lang.String headingText) " method present in "ReportObjectController" using which we can add the headings.<br><br>
    ReportDefController reportDefController = clientDoc.getReportDefController();
    ReportObjectController reportObjectController = reportDefController.getReportObjectController();
    reportObjectController.add( "{Table.Field}", "FieldName" );
    <br><br>
    I'm facing problems in using this code. When trying to use this function for my fields(Ex: reportObjectController.add( "{ IRS_REPORT_DETAILS.REPORT_ID}", "Report ID" );) it is giving me the following error:<br><br>"com.crystaldecisions.sdk.occa.report.lib.ReportSDKGroupException: The field was not found.---- Error code:-2147213310 Error code name:fieldNotFound"<br><br>
    <b>The following is my dynamic crystal report generation code:</b><br><br>
    public ReportClientDocument execute(String repName, String query) {
              ReportClientDocument boReportClientDocument = null;
              try {
                   boReportClientDocument = new ReportClientDocument();
                   boReportClientDocument.newDocument();
                      // Add a table based on the given Resultset to the report.
                   dbConnResultSet mySampleResultSet = new dbConnResultSet();
                   //mySampleResultSet.execute(query);
                   boReportClientDocument.getDatabaseController().addDataSource(
                             mySampleResultSet.execute(query));
                   IReportSource test = boReportClientDocument.getReportSource();
                   // Access all the database fields
                   DatabaseController databaseController = boReportClientDocument
                             .getDatabaseController();
                   IDatabase database = databaseController.getDatabase();
                   Tables tables = database.getTables();
                   ITable table = (Table) tables.getTable(0);
                   int NO_OF_FIELDS = table.getDataFields().size();
                   int LEFT_POSITION = 200;
                   // Add all the database fields to the report document
                   for (int i = 0; i < NO_OF_FIELDS; i++) {
                        IField field = table.getDataFields().getField(i);
                        FieldObject fieldObject = new FieldObject();
                        fieldObject.setFieldValueType(field.getType());
                        fieldObject.setDataSource(field.getFormulaForm());
                        IReportObject rep = (IReportObject) fieldObject;
                        IObjectFormat objformat = rep.getFormat();
                        objformat.setEnableCanGrow(true);
                        objformat.setHorizontalAlignment(Alignment.from_int(1));
                        rep.setFormat(objformat);
                        rep.setLeft(LEFT_POSITION);
                        rep.setWidth(1000);
                        LEFT_POSITION = LEFT_POSITION + 1000 + 50;
                        ISection section = boReportClientDocument
                                  .getReportDefController().getReportDefinition()
                                  .getDetailArea().getSections().getSection(0);
                                   //***************** Data being added to the report here, But headings are not added*****************
                        boReportClientDocument.getReportDefController()
                                  .getReportObjectController().add(rep, section, i);
                   boReportClientDocument.createReport();
                   /*Some report saving code is present down*/
              } catch (ReportSDKException ex) {
                   ex.printStackTrace();
              } catch (Exception ex) {
                   ex.printStackTrace();
              return boReportClientDocument;
    <br><br>
    appreciate your help.

    IField field = table.getDataFields().getField(i);
    Here you are getting the first field in the array.  This may not be the field you want to add since we aren't sure how the arrays are ordered when retrieving fields from the report.  It is better to retrieve the fields with the findObjectByName method, thus ensuring you are retrieving the field you want to add to your heading.

  • Passing single/multiple values to stored proc parameter from crystal report

    I tried below solution posted on this forum to pass either a single value or multi-value to a sql server stored procedure parameter (varchar datatype) from crystal report XI R2.
    In my crystal report , I am displaying all the available parameter values to the user  and the user will select either a single value or multi value.
    This worked when I select single value and when I say show sql query in my subreport  I see the following:
    {CALL "XYZ"."dbo"."storedprocedurename";1('Product  1')}
    But this did not worked when I selected multiple values and when I say show sql query in my subreport  I see the following:
    {CALL "XYZ"."dbo"."storedprocedurename";1('Product 1,Product 2')}
    I think it might work if it is as below:*
    For multiple values:
    {CALL "xyz"."dbo"."storedprocedurename";1('Product 1', 'Product 2')}
    Please advise.
    Solution Posted on this forum is as follows:
    Hi,
    As you must be aware of that a crystal report created of a stored procedure will allow only a single value for inserting a multiple value as a parameter in your report and pass those values to your stored procedure please follow the below work around which will be helpful for you.
    Symptom
    In Crystal Reports, you want to pass a multi-value parameter to a stored procedure. The problem with doing so is that Crystal Reports considers the multi-value parameter to be an array.
    How can you pass a multi-value parameter to a stored procedure?
    Resolution
    Here are the steps to pass a multi-value parameter to a stored procedure:
    1. Create a Crystal report, and add a multi-value parameter.
    2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
    //Formula: @JoinFormula
    Join ({?Multi-value parameter array},";")
    ====================
    NOTE:
    In the formula above, a semi-colon (";") is the delimiter.
    ====================
    3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
    4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
    Doing so passes a multi-value parameter to the stored procedure.
    Regards,
    Vinay

    Hi Vinay,
    First you need to make sure the stored procedure accepts multiple values in the fashion 'a','b','c'.
    Then, create this formula in the Main Report:
    numbervar i;
    stringvar s;
    for i:= 1 to ubound({?Parameter}) do
        s := s + "'" + {?Parameter}<i> + "'" + ",";
    left(s,len(s)-1);
    Link this formula to the sub-report's parameter.
    Hope this helps!
    -Abhilash

  • Insert OLE Object at runtime in a report (Crystal report 2008)

    Hello
    I need insert a WORD document at runtime into Crystal report 2008.
    Is it possible do it this using RAS SDK for .NET?
    Thank you

    Possible, but remember that only the 1st page of the word doc will be added - same as in the CR designer.
    There is a number of sample apps at [this|http://www.sdn.sap.com/irj/boc/samples?rid=/webcontent/uuid/80774579-b086-2b10-db91-ed58c4dda375] link. Add image sample may be good to look at.
    Also see [this|Display byte array image or ole object in Section through dynamic code?; thread.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Crystal report - how to split a field into more fields

    Hello,
    I`m new to Crystal reports and I`ve got a trouble. I have field which contains an address - street, city, zip code. The example is:
    STEHLIKOVA 977 165 00 PRAHA 620 - SUCHDOL 165 00.
    What I need to achieve is to split this string into three separated fields. I`ve trouhg a couple of forums but haven`t been able to find a proper answer. The problem is that the addresses differ so I can`t use an absolute defining of a start position. Looking at the DB (HEXA code) the parts in the string are divided by two dots:
    STEHLIKOVA 977..165 00 PRAHA 620 - SUCHDOL..165 00
    I`ve been able to work out this solution:
    stringVar array x := split({cparty.STREET_ADD},"..");
    Local numberVar i;
    Local stringVar outputString := "";
    For i:=1 to Count(x) do
    outputString := outputString + x[i] + Chr(10)
    outputString;
    It splits the string into three rows:
    STEHLIKOVA 977
    165 00 PRAHA 620 - SUCHDOL
    165 00
    And I don`t know how to find the end of each row so to be able to separate the strings and report them as three different fields.
    Would be anyone so kind and help me out with this?
    Thank you.
    Petr

    Hi
    Actually using a for loop is not necessary here. All you need to do is to add several formula fields: one for street, one for city and one for zipcode. In @street field you add formula:
    stringVar array x := split({cparty.STREET_ADD},Chr(13));
    x[1];
    Then you drag such formula field to details section of your report and watch preview to check if everything looks alright. Repeat for every formula field that you'd like see in your report.
    In @city you add almost identical formula but you change index, i. e. instead of x[1] you need to use x[2]. Then for @zip x[3].
    You may need to check if your address has all three parts - for example if you want to use formula in the second part of your address field you may need check first if there are at least two parts after split:
    stringVar array := split({cparty.STREET_ADD},Chr(13));
    numbervar c; 
    c := count(x); 
    if 2 <= c then 
    x[c]; 
    Var 'c' is used to store the number of elements in array after split. Then I'd like to check if the part (second) actually exists. So I try to check if number of part that I want to refer to is not bigger than the number of elements in array after split (here stored in var 'c').
    Actually the code presented above is not enough since you have no guarantee that you'll always get address structured in the very same way. For example in demo PL database I have zip code and city in the same row after split with Chr(13) as delimiter.
    You'll need to experiment or ask someone to prepare correctly structured data coming from B1 to your report.
    Kind regards,
    Radek

  • Crystal Report formula with datediff not working as expected

    We need a Crystal Report formula to display the number of seconds the oldest arriving call has been waiting.  Across multiple resources that can each have an "oldest call".  The database stores a datetime value for the time the oldest call arrived.  If there are no waiting calls, then this field is NULL.  (MSSQL database).  It seemed reasonable to implement this in a formula that 1) discovers the minimum of "oldest call" timestamps in the selected records, and 2) to use "datediff" to produce the difference (in seconds) between the "oldest call" timestamp and current time.
    The first attempt at this relied on "implied" iteration that could be done within a formula.  Something like:
    data: OLDESTARRIVALTIME
           null
           '2014-06-14 08:08:08.000'
           null
          '2014-06-14 08:07:55.000'
           null
    whilereadingrecords;
    datetimevar minArrival;
    if isNull({SVCCLASSMEASURES_VW.OLDESTARRIVALTIME}) = False
                   and minArrival < {SVCCLASSMEASURES_VW.OLDESTARRIVALTIME} then
         minArrival := {SVCCLASSMEASURES_VW.OLDESTARRIVALTIME};
    DateDiff("s", minArrival, {SVCCLASSMEASURES_VW.UTCDATE})
    We tried storing the values of OLDESTARRIVALTIME in an array.  We could see it iterating, but the values in the array only contained
    the column value from the first record.
    This was to solve the problem of screening null values and producing the minimum of the set.
    Since that didn't work (and the web articles seemed to imply this would iterate over all the records, we tried another approach.  This
    time we set NULL timestamps in the table to a timestamp far in the future, so that we could directly apply "minimum" to produce
    the correct "begin" for datediff.
    data: OLDESTARRIVALTIME
              '2030-01-01 00:00:00.000'
              '2014-06-14 08:08:08.000'
              '2030-01-01 00:00:00.000'
              '2014-06-14 08:07:55.000'
              '2030-01-01 00:00:00.000'
    datetimevar minArrival = minimum({SVCCLASSMEASURES_VW.OLDESTARRIVALTIME});
    datetimevar minUTC = minimum({SVCCLASSMEASURES_VW.UTCDATE});
    if minArrival < minUTC then
         DateDiff("s", minArrival, minUTC)
    else
         0
    (minUTC would be current time in UTC)
    So, to start things off, the last formula produces negative numbers!  They hover in negative seconds within a negative minute (-33, -45, etc.).
    That's inconceivable, considering the test for minArrival < minUTC.  Both of the fields are "datetime".
    As it turns out, in the near term, it's most important to get the second formula working.  And, of course, insights into getting the first
    formula to work are welcome as well!
    Have we run into some weird behavior of the "DateDiff" function?
    Thanks!

    If DateDiff is always returning a negative number you could try swapping the dates around in the call to DateDiff - it should look like this:
         DateDiff("s", minUTC, minArrival)    
    Or you could use the Absolute Value of the calculation:
         Abs(DateDiff("s", minUTC, minArrival) )
    As for your first formula, you need to initialize the variable to a value prior to using it in the comparison.  If you don't, its value is null and comparing it against a value won't work.  (See What is Null and Why is it Important for Crystal Reports | SAP BI BLOG for a blog that I wrote about working with nulls in Crystal.)
    You should change your existing formula to something like this:
    whilereadingrecords;
    datetimevar minArrival;
    if OnFirstRecord then minArrival := DateTime(2013, 1, 1, 0, 0, 0);
    if not isNull({SVCCLASSMEASURES_VW.OLDESTARRIVALTIME})
                   and minArrival > {SVCCLASSMEASURES_VW.OLDESTARRIVALTIME} then
         minArrival := {SVCCLASSMEASURES_VW.OLDESTARRIVALTIME};
    Note how I changed the If statement.  Also, you want to replace minArrival with the field value if the field is less than the current value of minArrival - so you need to use ">" instead of "<" in the comparison.  Place this formula in the details section.  It will now show anything because of the semi-colon on the end.  This will ensure that it gets evaluated for every record.
    Now, create a second formula that looks like this:
    whileReadingRecords;
    datetimevar minArrival;
    DateDiff("s", minArrival, {SVCCLASSMEASURES_VW.UTCDATE})
    Place this formula in a footer section - it will not work in a header section.  If you need it in a header section you might be able to take the "whilereadingrecords" off of both formulas and use the "Maximum()" summary function to get the correct value.
    -Dell

  • ComboBox control for Crystal Reports

    <p>Does anyone know if there are combobox style controls that can be used in crystal reports? We&#39;re using Business Objects XI R2 and Crystal Reports Developer XI to create the reports. Reports are delivered via Infoview.</p><p>The reports we&#39;re creating in Crystal has account number as an input parameter/prompt for the report. Some of our releationships have few hundreds to 1000 accounts. So the usability of a normal HTML SELECT control degrades pretty fast. A combobox would allow the user to type in partial names and scroll to that particular value. E.g.: The search on Google Suggest <a href="http://www.google.com/webhp?complete=1&hl=en">http://www.google.com/webhp?complete=1&hl=en</a></p><p>Does  WebElements have any control that can be used? Or are there 3rd party controls that are similar?</p><p>Thanks</p>

    Hi,
    I am looking for a Crystal Add-In to display a string that comes into my report as an array. I am using the Crystal JOIN function to get the elements, separate them by a comma and display them in a text object. This has worked well until I started working on a new report that returns many medication names as members of the array. Displaying them in the text box with "Can Grom" Checked has become quite messy, as this text box is in the Report Header section.
    What I would like to do is display them as a ComboBox (or dropdown, if that is the same thing) with the first medication showing (say Aspirin) and then the user can click on the drop down and see the rest of the medications in the array (Tylenol, etc.)
    This is display only data.
    It seems like the Crystal Report Webelements might do the trick. I have some questions:
    1 - Even though the link says you can incorporate web web controls onto your Crystal Report will this be visible from Crystal itself? The reason I ask is that we use a custom Report Viewer that basically renders on a web page what Crystal displays
    2 - Do WebElements contain the ComboBox I am looking for?
    Thanks,
    Dick Rosenberg

  • Need to sum hh:mm:ss in crystal report using Running Total Fields

    Hello,
    I am new to .Net and crystal reports so please go easy on me.
    I am trying to develop a crystal report using Visual Basic .NET. I have a column which displays the "Inbound Time" in "hh:mm:ss" format. I have to sum the total inbound time and display it.
    I tried using the Running Total and i am not successful.
    Here is the code which I am using in the Running total
    WhilePrintingRecords;
    if isNumeric({Report3;1.TotalInboundTime}) then
    {Report3;1.TotalInboundTime}
    else
    CStr ({Report3;1.TotalInboundTime});
    NumberVar array test2 := [ToNumber(left(CStr({Report3;1.TotalInboundTime}),2)),ToNumber(mid(Cstr({Report3;1.TotalInboundTime}),4,2)),ToNumber(right(Cstr({Report3;1.TotalInboundTime}),2))];
    StringVar test1 := CStr( (ToNumber(test2[1])3600)+(ToNumber(test2[2])60)+(ToNumber(test2[3])));
    InboundTime is the time field which is in "hh:mm:ss"  format.

    Hello Bharathi,
    There are a couple of KBs about this. I haven't tested them myself, but you could give them a try:
    [How sum multiple time fields in Crystal Reports|http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2008378]
    [Creating a running total to show the difference between two datetime fields |http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2010261]
    [Totalling time values that are stored as numbers in the database|http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2005576]
    Cheers,
    Fritz

  • Regarding Crystal Reports 2008

    Post Author: Swathi Godavarthy
    CA Forum: Data Integration
    Hi,
    Right now we are using crystal reports X1 release2 with RDC. We are not using crystal rpeorts integration with .Net rather we are using activex viewer. We are integrating crystal reports with ASP (Active Server Pages). We have decided to upgrade the version from releaseX1 to crystal rpeorts 2008. Does 2008 support RDC? Please if anyone knows let me know.

    Hi,
    Here's what you need to do:
    1) Create an array variable to accumulate the object 'C' when object 'D' = "T". The formula would be:
    WhilePrintingRecords;
    stringvar array C;
    numbervar i;
    if ({table2.D} = "T" and Not({table2.D} in C)) then
        redim preserve C<i>;
        C<i> := {table.C};
        i := i+1;
    Place the above formula on the Details Section.
    2) Create a new Report Footer b section. In the Report Footer a section, use this formula:
    whileprintingrecords;
    stringvar array C;
    Join(C,",");
    3) Insert a Subreport in the Report Footer b section with the same universe as the datasource
    4) Right-click the Subreport and select 'Change Subreport Links' > Move the above formula in the 'Fields to link to' area and uncheck 'Select data in Subreport based on field'
    5) In the Subreport create this new formula:
    if {table1.B} in {?Pm-@name} then {table1.B} else "Others" //{?Pm-@name} is the name of the parameter that we linked from Main Report to Subreport
    6) Create a group on the above formula
    7) Insert a summary on the 'A' field. Go to Insert > Summary > Choose 'A' as the field to summarize, select Count as the operation and choose the summary location to be 'Group 1'.
    This will show the Count of field A when table1.B in (select C from table2 where D = 'T').
    You can then suppress all the other sections of the Main Report except the section that holds the Subreport.
    The report will also show a group called "Others" that does not meet the condition. You can write a Group Selection formula to suppress this group:
    Not(@formula_name = "Others")
    Let me know how this goes!
    -Abhilash

  • Using Crystal Reports XI, Version 11.0.0.1994, "This field cannot be summarized." Message

    Post Author: Caroline Richards
    CA Forum: Crystal Reports
    I am currently working on a revenue report that has details with groupings for account, rate codes, and categories of rate codes. 
    Revenue for each account can be adjusted, and the adjustment is linked to the original revenue amount by an Accounts Receivable Transaction Number.  The correct summary for higher groupings are affected when an adjustment is made to the same revenue amount (same AR Transaction Number) more than once.  I have been able to calculate the correct revenue amount in a formula, leaving out the duplicated revenue when there's more than one adjustment on the revenue; however, when I try to summarize the calculated revenue amount in any way, I get a message stating:  "This field cannot be summarized." 
    Is there a way around this so that I can use the calculated amount?  Will an array work?

    Post Author: SKodidine
    CA Forum: Formula
    In CR, you cannot summarize on a summary field.  Since the formula already has a summary function in it, you will not be able to summarize on the formula field.
    Workaround would be to calculate summaries using a running total or another formula and thus avoid the summary using summary situation.

  • Crystal Reports data connection using Java beans

    Hi
    My name is Bach Ong, i'm currently perform re-configuring Crystal reports 2008 to connect via
    Java bean to Jboss server, this uses look up service on JBoss server. The connection is using Connect
    look up using the properties:
    java.naming.provider.url=jnp://emgsydapp121:10499
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    for file CRConfig.xml i put as follows:
    <JDBCURL></JDBCURL>
    <JDBCClassName></JDBCClassName>
    <JDBCUserName></JDBCUserName>
    <JNDIURL>jnp://emgsydapp121:10499</JNDIURL>
    <JNDIConnectionFactory>org.jnp.interfaces.NamingContextFactor
    y</JNDIConnectionFactory>
    <JNDIInitContext>/</JNDIInitContext>
    <JNDIUserName></JNDIUserName>
    Can you advise us if this step is correct, and is there any
    documentation that can guide us to right direction.
    for Java testing in Eclipse using remote call class it is working suing the following code:
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             InitialContext ctx = new InitialContext(p);
      Date asAtDate = CrystalUtils.convertToDate("2014-01-01", CrystalUtils.relativeToToday(0), false);
         String asxCode = "BHP";
         ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
         InitialContext context = new InitialContext(p);
         ClosingPricesReportService ejb = (ClosingPricesReportService) context.lookup(ClosingPricesReportService.REMOTE_JNDI);
         ClosingPricesReport report = ejb.createMTMClosingPriceReport(criteria);
         System.out.println(report.getClosingPrices()[0].getClosingPrice());
         testval = report.getClosingPrices()[0].getClosingPrice().toString();
         System.out.println(testval);
    when i run the tes code the results as follow:
    10:49:45,244 DEBUG [SecurityAssociation ] Using ThreadLocal: false
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] constructed
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connecting
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] Creating semaphore with size 50
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connected
    10:49:45,369 DEBUG [ClientSocketWrapper ] reset timeout: 0
    10:49:45,650 DEBUG [InvokerRegistry ] removed SocketClientInvoker[709446e4, socket://emgsydapp121:10473] from registry
    10:49:45,650 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] disconnecting ...
    10:49:45,650 DEBUG [SocketWrapper ] ClientSocketWrapper[Socket[addr=/10.137.2.40,port=10473,localport=64150].2cba5bdb] closing
    37.99000000000000198951966012828052043914794921875
    37.99000000000000198951966012828052043914794921875
    Can anyone assist me in convert the above settings to get access by Crystal reports.
    My attemp current are below:
    public class CFDClosingPricesRpt extends CrystalReport {    
        //Constructor
        public CFDClosingPricesRpt(){
            super(ClosingPriceBean.INSTANCE);
         * Returns the ResultSet for this report to Crystal.
         * @param asxCode
         * @param asAtDateString
         * @return
    public ResultSet getNewReport(String asxCode, String asAtDateString) {                     
         try {
             Properties p = new Properties();
             p.put(Context.INITIAL_CONTEXT_FACTORY,
             "org.jnp.interfaces.NamingContextFactory");
             p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
             p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             //InitialContext ctx = new InitialContext(p);
             clearCachedReportBeans();     
       Date asAtDate = CrystalUtils.convertToDate("2013-01-01", CrystalUtils.relativeToToday(0), false);
          asxCode = "BHP";
          ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
          //ClosingPricesReportService ejb = (ClosingPricesReportService) ctx.lookup(ClosingPricesReportService.REMOTE_JNDI);
          ClosingPricesReportService ejb = (ClosingPricesReportService) ServiceLocator.getInstance().getService(ClosingPricesReportService.REMOTE_JNDI);           
          ClosingPricesReport report = ejb.createClosingPriceReport(criteria);
          // assemble Crystal-friendly DTO
          Collection closingPrices = Arrays.asList(report.getClosingPrices());
          for (Iterator iter = closingPrices.iterator(); iter.hasNext();) {
                    MBLXClosingPrice cp = (MBLXClosingPrice) iter.next();               
                    if (cp==null) continue;               
                    addReportBean(new ClosingPriceBean( report.getSuppliedDate(),
                                cp.getClosingPrice(),
                                cp.getAsxCode()));
      } catch (Throwable x) {     
          saveErrorMessage(x);
      return getAsResultSet();             
    Thanks
    Bach Ong

    Hi Don Thanks for the reply.
    I've was able to connect via Java beans and JNDI. But this one is going the JNDI of JBoss sever, which the JNDI already configure and working for Crystal reports v10.
    Bach

Maybe you are looking for

  • How to unlock internal Hard drive for other user

    i have fast user switching set, and i can log on to that user's desktop.  however, when i try to start iTunes, i get a message that says the hard disk is locked.  So iTunes won't open.  I had set a whole bunch of songs for this user, but now can't se

  • Taking the Labor out of Labor Day: HP Support Assistant

    Did you know that temporary files should be removed from your computer and that the hard disk should be defragmented regularly? Just like any appliance that used on daily basis, computers need regular maintenance to perform well. In honor of Labor Da

  • Product Hierarchy field in WBS

    Hi Everyone I have checked every where and still unable to find solution that whether can we add product hierarchy field in WBS or not? If yes then how can i? I have already checked at spro>img reference>project systems>structures>operative structure

  • Inbound Freight payment

    Hi, Will anyone guide me for  Steps to configure inbound freight payment functionality pl.

  • Transparent Brush?

    Hello everyone, I know that there is a feature in Photoshop cs6 which will change your brush into a tool that affects the opacity of the layer it is used on. That is to say, if layer 1 was all blue and layer 2 was all green, using this brush tool on