Formula in Crystal

Hi,
I am trying to use a formula in crystal report. I have a dataset that contains list of customers. I wanna assign different numbers on report to each customer. I dont have any idea how to do it. Any help.
Thanks

Hi, 
That description helps a lot.  What you need to do before we create the PickList is get a list of all the customers into an array and assign them a number.  I'm going to recommend a subreport to generate the array. 
Create a subreport that will link to your picklist so we can get a DISTINCT list of the customers.  In the subreport create a formula like: 
WhilePrintingRecords;
Shared StringVar MyCustomers;
myCustomers := myCustomers & {table.CustomerName} & ",";
This should go into the Detail section. 
In the Report Footer we just need to clean up the string like: 
WhilePrintingRecords;
Shared StringVar MyCustomers;
If Right (MyCustomers, 1) = "," Then
    MyCustomers := MyCustomers [1 to (Length (MyCustomers) - 1)];
This will remove the trailing comma separator. 
If  you have the main report grouped by PickList, drop the subreport into the Group Header and link them.  If your report is generating 1 picklist then drop it into the Report Header. 
Now you can create a formula in the main report like: 
WhilePrintingRecords;
Shared StringVar MyCustomers;
StringVar BoxNo := "";
NumberVar i;
i := 1;
If  {table.CustomerName} In Split (MyCustomers, ",") Then
    For i := 1 to Count (Split (MyCustomers, ",")) Do
        If Split (MyCustomers, ",") <i> =  {table.CustomerName} Then
            BoxNo:= ToText (i, 0, "", "") 
        Else "";
BoxNo;
This formula converts the customer list into an array and loop through the array to return the element number as the box number. 
Good luck,
Brian

Similar Messages

  • Accessing trend line formula in Crystal Report

    I am using Crystal Reports 8.5 and CR2008.  I have a report showing a trend line (specifically the quadratic regression).  I can show the formula that is being used for the report in the chart.  How can I access the regression formula in Crystal Reports?
    Thank you for your help.

    hi James,
    in short you can't...the charting engine is a separate 3rd party dll so what you see there is not necessarily available in the rest of cr in summaries etc.
    in order to do things like this, you either have to do the calcs on your database or using formulas. i've attached an example of linear regression that i did a while ago. change the .txt extension to .rpt after you extract the contents. sorry, there are no instructions on how to do this.
    on the attached sample though it does figure out the regression formula and also extrapolate data, show residuals etc.   there are a couple of other "fits" in a parameter but i never finished those as it made my head hurt
    -jamie

  • Working days formula and Crystal 7 - is it possible?

    Post Author: Tim F
    CA Forum: Formula
    Hi folks,
    Really hope someone can help, I'm struggling with writing a report that needs to show the difference between two dates in working days. I've found the same formula posted here several times but cannot get it to return a logical value in my report. I'm wondering if that might be because I'm using an older version of Crystal? The formula in question is this one:
    //Main formulaWhileReadingRecords;Local DateVar Start := ({PPV_COMPLAINTSEH.DTRECD});   Local DateVar End := ({PPV_COMPLAINTSEH.ACTCMPLTD}); Local NumberVar Weeks; Local NumberVar Days; Local Numbervar Hol;DateVar Array Holidays;
    Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;Days := DayOfWeek(End) - DayOfWeek(Start) + 1 + (if DayOfWeek(Start) = 1 then -1 else 0)  + (if DayOfWeek(End) = 7 then -1 else 0);  
    Local NumberVar i;For i := 1 to Count (Holidays)do (if DayOfWeek ( Holidays&#91;i&#93; ) in 2 to 6 and      Holidays&#91;i&#93; in start to end then Hol:=Hol+1 );
    Has anyone come across an alternative way of doing this, or have any ideas why this formula is not working in my report? Any advice would be much appreciated,
    Regards,
    Tim

    Post Author: Charliy
    CA Forum: Formula
    You set up a Running Total.  Drag the filed you want Summed, Select Sum as the operation if that is not the default.
    Just below that you weill see Radio Buttons that say For Every Record, On Change of Group, On Change of Field, Use a Formula, etc - click the one that says Use a Formula.  The Blue Bos to its right will turn Red, click on it, this is where you put your formula: NOT(DATEPART('w',{table.date}) IN &#91;6,7&#93;)
    Save that, then just decide if you want it reset on a Change of Group, or Never (Grand Total).  Give it a name and put it on your report.

  • Is there a way to Extract all formulas from Crystal Reports files?

    Hi:
    I have about 40 Crystal Reports (.rpt files).  I need to go through each one and look at formulas if a certain variable/value is used since it has currently changed.  It is taking way too long and not to mention inefficent to open each file, look through any place where there could be custom formulas such as when to suppress - etc.  Is there are way to easily exact all custom formulas from all those report into say a Text file so I can do a Search for it?  That would be the easiest way to find what I'm looking for.
    I have Crystal Reports XI.
    Thanks in advance for your help.

    One option is to use a tool such as rptInspector.  See: [http://www.softwareforces.com/Product/ri/pro/3/rptInspector.htm|http://www.softwareforces.com/Product/ri/pro/3/rptInspector.htm]

  • How to set Formulas in crystal reports 2008

    Hi,
    I am generating crystal reports in vb6 using CR 8.5 and vb6 and below is the code snippet for the same
    CrystalReport1.Formulas(0) = "PrintTitle= '" & strMyTitle & "'"
    CrystalReport1.Formulas(1) = "FromDate= '" & MskFromDate.Text & "'"
    CrystalReport1.Formulas(2) = "ToDate= '" & MskToDate.Text & "'"
    Please let me know how the same functionality can be achieved in VB.Net using Crsytal reports 2008
    Any code snippet would be of great Help.
    Thanks in Adnvance.
    Ramnath

    Something like this:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Report As New CrystalReport1()
    Dim FormulaFields As FormulaFieldDefinitions
    Dim FormulaField As FormulaFieldDefinition
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FormulaFields = Report.DataDefinition.FormulaFields
    FormulaField = FormulaFields.Item(0)
    FormulaField.Text = "[formula text]"
    CrystalReportViewer1.ReportSource = Report
    End Sub
    Also, see the Developer help file:
    http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_dg_12_en.chm
    API reference:
    http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_apiRef_12_en.chm
    and [Crystal Reports for Visual Studio 2005 Walkthroughs|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23]
    And don't forget to use the search box at the top right of this page before posting to the forums...
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Edited by: Ludek Uher on Jul 26, 2010 8:57 AM

  • SQL or Formula in Crystal 8.5?

    Hello Forum Oracles!
    I am new to Crystal and SQL. I have had no formal training in any aspect of IT but have a good understanding of certain things. I have been around windows based PC since the early 1990s. I need help in writing a formula or SQL I know not which. This is my problem.
    We are a vending company and have men that fill up these machines with stock. I am producing a report to forcast their stock requirments based on the amount of machines they service, new machines in their area and historical usage of stock. I have a parameter where I can enter usage in a period between dates but what i would like is for the report to automaticlly tell me what they have used in the last 42 days. I have used the SQL experssion {fn NOW()}-42 to return a date 42 day pervious but I am now stuck on how to get this in a report. This is as far as my logic and abilities take me:
    vw_StockMovement_Usage."amendedAt" BETWEEN {fn NOW()} AND {fn NOW()}-42
    Your help will be very much apprecated.
    David

    Hi David,
    You can get rid of the parameter and instead use a record selection formula like this (Report > Selection Formulas > Record):
    vw_StockMovement_Usage."amendedAt" >= dateadd("d",-42,currentdate)
    Hope this helps!
    -Abhilash

  • Programmatically create objects and formulas in Crystal Reports XI Developer edition?

    <p>Is it possible to programatically/dynamically create a text, line, formula field object, etc. in Crystal XI Developer edition?  I have been programming with the Crystal .Net reports component that came with VS 2005 for the past 6 months and know for a fact you can&#39;t programmatically create those objects although you can programmatically control their properties.  My intention is to create a dynamic report that can be reused extensively.  My current work-around for this was to create a generic report with about 40 formula field objects which draws data from 40 corresponding formula fields that I can programmatically set it&#39;s formula thus imitating a report field.  I want to update to the developer edition because I heard with this edition we can programmatically create and manipulate these objects but I found no reference or examples anywhere that proves we can do this?  Does anyone know for a fact or point me to the right place to look for documentation?  TIA</p>

    Hi,
    How can I programmatically refresh list of values status on CR server XI R2?
    Currently, after I modified the data source in the data connection, some of the LOVs in the report prompt window became empty when I tried to generate the report. I have to use Business View Manager to log onto the Crystal reports server XI R2, find and double click the list of values object to bring up the Edit LOV window, and then click on "Refresh Status" button to make the LOV available in the report prompt window.
    What SDK should I use to create a simple application (preferable a desktop application) to find all LOV objects on CR server XI R2 and to refresh their status? That is an application similar to the "Refresh Status" function in Business View Manager.
    I found Report Engine SDK has the Lov.Refresh function to refresh LOV. On the other hand, Report Engine SDK seems to be for BusinessObjects Enterprise, not for Crystal Reports Server. Can this or other function achieve what I want, i.e. to refresh list of values status on CR server XI R2? If yes, can I use it to develop a self-contained desktop application instead of a web application? I only need to run this application after I modify the data source in the data connection, so I prefer not need to deploy it as a web service.
    Thanks for your help.
    C.T.

  • Last date for an invoice formula for Crystal Reports

    Post Author: jegva
    CA Forum: Crystal Reports
    I sure hope someone can help me write a formula to list only the last dated invoice from our database.  Let me explain, our sales would like a report listing all of our customers showing their last dated invoice.  We use SQL and Crystal Reports 8.5 (yea outdated).  They are interested in showing all our customers and their last invoice/date so they can try to contact those who have not done business for some time. Please help!!!!!!!

    Hi Scott,
    One reason is the older versions introduced a .5 font reduction in the viewers. This was a good thing for some but bad thing for others so I assume what the developers have done is leave the font as is and show those # symbols now to indicate the viewer you are using and font you are using works differently on the OS and the various viewers being used.
    In CR designer it uses the GDI+ to render the data through classic C++ function calls. I .NET it too uses GDI+ but it's the Framework making the calls and the Framework handles screen mapping differently. We've had this issue/functionality limitations since version 9. Various reasons and various work arounds resulted in various outputs.
    Another reason is the C++ viewer built into the Report Designer and the .NET framework handling the fonts work slightly differently when rendering. This has been tracked and few times here by me and in both cases the cause is GDI+ has bugs in it so it's nothing we can do. Post or log your issue with Microsoft, they may be able to fix it. Once they do then if it's still a problem in CR we can fix it depending on what MS does.
    Another work around may be to use a fixed font like Courier or some other font that has a specified character area all characters use, it may make the characters space oddly but as for displaying it's always the same size.
    All I can suggest is they get into a practice of testing their reports in your app before "publishing"
    Thanks again
    Don

  • Formula in Crystal Report

    hi
    can anyone tell what is the error in this formula
    if  not isnull {GetDataTable.MARK_PRICE_RATE} then
    (({GetDataTable.mark_price_rate} * {GetDataTable.BILL_DET_COUNT})  -  {GetDataTable.JARIMEH } )
    it is displaying the error like this
    The keyword 'then' missing

    Hi,
    Please post your question at crystal reports forum below for a better assistance on this, this is C# code related forum:
    https://scn.sap.com/community/crystal-reports
    Regards,
    Fouad
    Fouad Roumieh

  • Hyperlink using formula in Crystal Reports 8.5

    Is there a way to create hyperlink formula to link to nth page in the report (in the exported pdf file)
    for example:
    i want to created a link to a text and when clicked on the link it should take me to page 8 in the same report.
    Thanks
    -Vivek

    Hi Navin
    Thank you so much for your response.
    Is it particular to any one single report or all the reports which contain hyperlink.
    basically it's just one report that should have filer names and pages numbers in the first page followed by the detailed report of all filers
    Also let us know to what type you are linking to, Is it any email address else a website or a file type.
    The table of contents is loaded from a sub report which is connected to a temporarty table with filer names and page numbers.
    it's a database field
    -Vivek

  • Adding formula in crystal report

    Hi Experts,
    I am trying the below formula to combine the fields to consolidate the address .
    whereas, if there is any null field in the combination, i getting the blank output. how to fix this in CR2011 ?
    {OCRD.Building} +" "+ {OCRD.Block}
    Thanks in advance,
    Dwarak

    Hi got it, default value for nulls on the top of formula screen.

  • Passing values at run time through a JSP page to selection formula to crystal report

    <p>hi,</p><p>   i am using one jsp page.in that page there is a field to select a date </p><p>this value will go to the report and report contain one selection formula.</p><p>which value we are passing on that basis the report should display</p><p>with date which we are passing  from GUI.</p><p>help.............................................................</p><p>//R</p>

    I believe the value of this is based on the owner of the scheduled object.  So if the Admin is scheduling it on behalf of a user I think it should use the user the Admin scheduled on behalf of.  It should be simple to test, simply create a report with this value being displayed and nothing else and see what values you get.

  • Formula Help Crystal Reports 11

    Hello,
    I am having trouble with a selection formula.  I wrote a report that queries 2 tables that have been joined within my report.  A primary table and a secondary table. The secondary table can contain multiple detail records that are associated with each primary record.
    There is a field in each record of the secondary table that contains an alpha character.  I need a slection formula to scan through the fields of the secondary records and if one of those secondary records has a particular value (In this case "T") I would like ALL of the secondary records included in my report along with the primary record indexed to it.  If no secondary record in the series has a value of "T" then all records should be excluded from the report including the primary record indexed to that series of secondary records.
    Is there a function I can use to accomplish this type of logic?...an example of the appropriate syntax would be helpful.
    Your help is much appreciated!
    Mark

    Hi Mark,
    Use the InStr function.  This will allow you to search for a string and it will return a numeric value which represents the placement. 
    Instr ({Table.FIELD}, "T") > 0;
    This will return all records that have a "T" in that field. 
    Good luck,
    Brian
    Edited by: Brian Dong on Oct 23, 2008 4:39 PM

  • Crystal report formulas to view revenue for current & Previous Year

    Hi all,
    We have a requirement to create a formula in crystal reports to display the current month revenue and previous month revenue along with few dimensions and also current fiscal year revenue and previous year.
    For ex on SAp ecc table CE11000.
    Please provide the syntax for above requirement.
    Quick response is appreciated.
    Thanks.
    DJ

    HI AlunJD,
    Thanks for your quick turnaround.
    Here's the structure of table i have fields like Currency type,Document Number,Fiscal year , Company code,country, Countrygrp,Document type, Sales quantity & Revenue.
    My requirement is to display Revenue for current Fiscal Year and Previous Fiscal year and aswell as Current Month And previous month in the same report.
    Is there any functions to create a formula to display data on above mentioned logic.
    Thanks.
    DJ.

  • Does BOXI support crystal reports with parameter references in formulas?

    I am designing a report in Crystal Reports XI Developer that contains parameters, which are passed to a stored procedure and are also used within formulas ( in Crystal Syntax ie. {?FORMAT_ID} ) in the report itself.
    I can run the report successfully in CRXI Developer.  The formulas use the correct values from the parameters entered during execution and everything looks good.
    I then deploy the report to Business Objects Enterprise XI.  I do all of the things necessary to manage the report including setting up the proper database connection information and default parameter values.
    When I run the report using the Crystal Report Viewer, I get the following error message:
    Error in File Forecasting.rpt:
    Error in formula <Report Format>.
    'if (not isNull({?FORMAT_ID} ) ) then
    This field name is not known.
    Details: errorKind
    This happens when I press the "Preview" button in the Manage Object dialog from Crystal or when I run the report using InfoView.
    I have changed the formulas and it doesn't seem to matter what the specific content of the formula is; other than the existence of a parameter reference in the formula.  If I comment out the parameter and replace it with a hard-coded value, it gets through the formula fine.
    Does Business Objects Enterprise XI support crystal reports with parameter references in the formulas?
    Thanks,
    Tim H.

    Hi,
       In Crystal Reports under File -> Report Options >check convert Null Values to default > Verify on first refresh > Verify stored procedures on first refresh.
    This corrected the issue by allowing the query engine time to locate those columns and map them to the query being sent by the report.
    The convert null values was added because those field were being used in the record selection and grouping.
    Regards,
    Vinay

Maybe you are looking for

  • Replication of Users from portal to R/3

    Hi, I would like to develop a portal functionnality that allows replication of users from portal to R/3. I know that the functionnality already exists in portal but we need to do another one because of special requirements. How could I find the java

  • Purchased movies in HD?

    I have rented a few new movies but cannot figure out how to watch them in HD? Is HD available for these movies? Is there some setting I am missing? thanks for you suggestions! Solved! Go to Solution.

  • Framed-IP-Address in auth

    i have Cisco 7206VXR IOS 12.2(6c) setted up for pptp users and aaa (Radius) accounting... now i have to check source IP of the client during the authorization... But can't find it in auth packets. Only in start/stop/alive (Tunnel-Client-IP or somethi

  • Won't remember startup disk

    Every now and then my iMac forgets which is my startup disk. I have two external drives attached. I HAVE made the selection in system preferences many times, but occasionally, when I start up, instead of the apple, I get a blank screen.  If I unplug

  • Double suspend (pm-suspend)

    hi everyone, I have a little problem with my laptop. this is the way I suspend my laptop: I open a terminal and type "sudo pm-utils", suspends perfect, then I push the power button, everything resumes fine, but if I don't stop kill the pm-suspend com