Using Summary or Formula fields based on what a string field has.

Attached is an example report that was not created by Crystal Reports.  I am working on re-creating it in Crystal Reports.
I am using Crystal Reports 2011.
The Total line for each group of details needs to have sum total fields for only items for pieces, weight, etc. whose Serial No does not begin with B.  How do I do that?

Hi Keith,
Create a formula that defines a variable we will use.  This will go into a group header and resets the variable to 0 when the group changes.
@intialize
WhilePrintingRecords;
NumberVar myTotal := 0;
Drop this into the group header of the group where the total will appear.
Your second formula will do the summing and goes usually goes into the Detail section:
@process_records
WhilePrintingRecords;
NumberVar myTotal;
if left (Uppercase ({table.FIELD}), 1) = "B" then
    myTotal := myTotal + {table.numberfield}
Else myTotal;
So this formula checks your field for the letter B.  You may not need to use Uppercase.
The last formula will go into your Group Footer where you want your total to appear like:
@showtotals
WhilePrintingRecords;
NumberVar myTotal;
And that's it.  Notice the variable is populated with := and not just =.  The single = is a comparison so make sure you use the correct on.
Good luck,
Brian

Similar Messages

  • Select records based on formula field

    I have a formula field that I am trying to sort data by. I want to eliminate records that come up with a 0 in this formula field. I tried select expert, but it doesn't recognize the field.

    Hi Steve,
    You cannot sort on a formula field that uses printime functions or executes in the 'whileprintingrecords' phase - example would be running totals or formulae based on shared variables from the subreport.
    What you can however do is, suppress records where the formula returns zero.
    To do this, go to the Section Expert > Select the section you wish to suppress > Click the formula button beside 'Suppress' and use this code"
    {@Formula_name} = 0
    -Abhilash

  • Is it possible to use a DateDiff formula within a single field?

    Post Author: EarthMover
    CA Forum: Formula
    I have a field that lists transaction times for the signing on and off of maintenance tickets.
    My problem is that since both the sign-on and the sign-off are in the same field, I don't have the
    option of using the DateDiff formula like I normally would ex: DateDiff ("Interval",startDatetime, endDateTime).
    Because the start-date and end-date are in the same field, the formula returns no value.  To combat this
    I believe that an IF/THEN/ELSE statement would work, if I made one for the start-date and one for the end-date.
    My transaction field is using a DateTime format ex: 10/28/2007  11:58:07.  I tried making the IF portion of the statement
    dependant on another field that tells me if they've signed off or on ex: ACDN or ACUP, both of these are examples of someone
    signing on to a ticket,  and signing off of a ticket results in: COMP.  Based on this information I believe it should be possible to create
    a conditional statement to return to the information I require. I've attached an example of what I see, at the bottom.
    I've only been using Crystal for a couple of weeks now, so I'm still learning, any help would be greatly appreciated.
    PROBLEM DESC TEXT    COND   TRANSACTION TIME
    NEED RAILING FIXED       ACUP    10/25/2007   12:43:16AM
    NEED RAILING FIXED       COMP   10/25/2007   2:35:22PM

    Post Author: yangster
    CA Forum: Formula
    well this is what i can think of off the top of my head to deal with your problemyou are going to need create a variable for both begin and end date and this will have to be evaluated at the group footer levelHere is the sample data i will be working withID     Condition  TimeABC  ACUP     10/25/2007ABC  COMP    10/26/2007DEF  ACUP      10/25/2007DEF  COMP     10/27/2007create a group on the unique id, this will seperate ABC from DEFnext create the formulas to strip out the begin and end dates@begin_date_init (place in group id header)whileprintingrecords;datetimevar begin_date := datetime(0000, 00, 00, 00, 00, 00)@begin_date_eval (place in detail section)whileprintingrecords;datetimevar begin_date;if left(condition, 2) = "AC" then begin_date := time@begin_date_display (place in group id footer)whileprintingrecords;datetimevar begin_date;begin_date;the end date is identical except the if statement will be if condition = COMP then end_date := timeafter you've dropped these formulas in their appropriate places in the reportsupress the detail and group header sectionsyou will see that you will see something along the lines ofABC  10/25/2007  10/26/2007DEF  10/25/2007   10/27/2007so its just a matter of creating a simple formula to calculate the diff between your 2 variables@date_diffdatediff("d", @begin_date_display, @end_date_display)this should do what you are trying to do, the layout may be different then you have pictured so you can play with it but its a starting pointswell i'm off to whistler for some R&R if this doesn't work i'm sure someone else here can try to help you figure out something that works

  • Calculate CUmmulative Using Formula Field

    hi all community,
    i want to calculate Cumulative of a field by using formula In Query Designer. Plz help me to calculate cumulative not by setting its property but using formula field in query designer.
    Thanks in advance
    Edited by: Abdul_Hafeez_25 on May 9, 2010 10:09 AM

    Hi,
    norammly field means as per your requirement it is key figure only for that the better option is cumulative property can b used
    but u said u want use in forumla
    but the values are based on which characterstic those are coming
    u can restrict those values with characterstics in RKF  and all the RKF can be used in formula. but i am not getting actuall what is the requirement, can you expalin  some detailed level.
    if i know i can give some input.
    Thanks & Regards,
    sathish

  • Working with 3 Reports -- How to Display Summary/Formula field in Each Repo

    I have 3 Report that represent three Company.
    Each Company/Report has their report Details and field totals at the bottom.
    Now what I am trying to accomplish is that I need to add all three companies grand total and sum it up and display at the bottom of each reports.
    FYI, I have created matrix report and i pass user parameter where user can choose which company's report him/her would like to run so for example: if user run Company_1 then at the bottom i want to display all the companies Grand Total.Each reports have 6 columns and all the columns are same in each report except the data change by company. and with the same thing with Company_2, and Company_3
    Now, I tried to use create a separate query and tried to use DATA LINK but it didn't work due to very awkward report design.
    Is there a way where i can create a formula field and write PL/SQL and display at the bottom of my report.
    Please let me know if its possible I will very appreciated.
    Thank You

    Thanks for your reply,
    Actually, I would done that before taking Company's parameter off but i have to send out this report to all three companies thats resoan why I put companies paramters.
    Also, I have solved that problem by creating new query that will give me total off each company so in my Data Model. I have Q_1 (main query), Q_2 (Company 1 query which give me total for each field), Q_3 (Company 2 query....), Q_4
    and call those all fields and RESET AT REPORT level.
    so, no mather which company i choose in my parameter field it will give me final total at the bottom of my report for all the departments.
    Thank You,

  • Crystal Reports XI - How  to create a new field using a formula field

    I'm quite new to CR, but have been learning quickly!
    I would like to know how to automatically create a new record/field based on another field in that row...
    I have a report showing the following data:
    Run Code     Start KM    Stop KM    Status 
    H2                 100            150           Partial
    H2                 150             155          Partial
    H2                 155             160          Partial
    S3                 120             150       Completed
    The status is generated by comparing the 'Start KM' and 'Stop KM' against fields in another table called 'Start Odo' and 'Stop Odo'
    In this example...
    H2 has 'Start Odo' and 'Stop Odo' values of 90 to 160, therefore there is still 90-100 to check.  The 'Start KM' and 'Stop KM'  is equal to the 'start Odo' and 'stop Odo' for S3, therefore it shows completed.
    My question is how do you create a formula field, which will add an entire row...displaying the values 90-100.
    I've been trying to use a conditional check in the 'Start KM' column, that sees if status is equal to partial than if start km is greater than start odo (Which is the reference km) then display the value of start odo in the new row. I'm stuck at how to create a new row.
    I want the final result to look like this...
    Run Code     Start KM    Stop KM    Status 
    H2                  90              100         Partial
    H2                 100             150          Partial
    H2                 150             155          Partial
    H2                 155             160          Partial
    S3                 120             150       Completed
    Any suggestions would be more than appreciated

    Hi Adi
    Looking at your examples it seems that you want to add a row to the existing recordset (rows fetched from the database).
    If it is the case (even if based on a formula) then you can not do it within crystal. Crystal is designed to display data and ideally it should not generate the new data.
    However, as per your requirement you can try to add this logic at database end. May be a command object within Crystal Reports can help you.
    Let me know if you do not understand anything.
    Regards
    Nikhil

  • How can i use a blob field in a formula field object

    Hi ,
    We are using Crystal Report Server XI R2.  i have a field "ANSWER" in my datasource which stores value 1 or 0.
    And i have table to store two images as blob fields are "EVALTICKIMAGE" and "EVALCROSSIMAGE".
    Now i need to show an image in my report for the field "ANSWER" instead of 0 or 1.
    So i written a formula to achieve this. my formula text is follows:-
      oFormulaField.Text = @"if {CSP_PROCESS_REPORT.ANSWER} = ""1"" then {EVALIMAGE.EVALTICKIMAGE} else {EVALIMAGE.EVALCROSSIMAGE} ";
    but this does not works for me. i recieve an error "A blob field cannot be used in a formula".
    is there any other way to show images based on a condition.
    or is that possible to use blob fields formulafield, kindly help me.
    Thanks,
    Padmanaban V

    You can use conditional suppression instead.
    Place both image fields on the report. Right click the 1st image field (EVALIMAGE.EVALTICKIMAGE) and choose Format Graphic and make sure the Format Editor is on the Common Tab.
    Click the x-2 button across from Suppress and enter the following formula:
    IF({CSP_PROCESS_REPORT.ANSWER} = 1 THEN FALSE ELSE TRUE
    For EVALIMAGE.EVALCROSSIMAGE, do the same thing except change the formula to:
    IF({CSP_PROCESS_REPORT.ANSWER} = 0 THEN FALSE ELSE TRUE
    Once that's done, you can set one image directly on top of the other.
    HTH,
    Jason

  • Using formula field as parameter to subreport fails

    Anyone passing formula fields to subreport to feed into a SQL stored proc?  I'm using Crystal XI to develop the report and I haven't consistently been able to get it to work. 
    The main report is essentially a shell to call the subreport.  I have created a variable to store the currentceusername value so it can be passed to the subreport as a parameter.  This doesn't work immediately since I get the error message "Database connector error '42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Procedure or Function 'usp_PG0123...' expects parameter '@username', which was not supplied. [Database vendor code: 201]
    But I have set up that parameter in the Subreport Link.  My workaround is to edit the subreport, refresh the report and enter the parameters to the subreport to retrieve data.  Close the subreport and the main report will now function properly and pass the data to the subreport.
    After it is working locally in my CR XI, I save the report to the BOE XI server.  Running the report on the server I get "Error in file reportnamerpt: Database Connector Error".  My local copy of CR XI is patched with the latest SP and hotfixes.  Our BOE XI server is on SP3 with hot fixes. 
    I can't figure out what I'm not doing right... I have been constantly removing and re-creating the subreport and re-creating the sublinks.  This error does not occur if I replace the formula field with a regular parameter in the main report to feed to the subreport.
    Anyone have any suggestions?
    Thx.
    Patrick

    I know this can be done, because that's basically how I pass multiple-selection parameters to an SQL Command.
    The only thing I can think of is if the data types of the formula field is not exactly the same as the database parameter, Crystal may drop the link or something.  That's pretty much a WAG, but it's something...
    HTH,
    Carl

  • Summary on a formula field that makes a condition on a running total

    Hi,
    How come I can't create a summary on a formula field that makes a condition on a running total ?
    My running total field is a counter that counts the number of individuals
    My formula field contains this info :
    IIF ( ( {#counter_running_total} <> 1)
        or ( {#counter_running_total} = 1
              and {status.code} = '04' )
        or ( {#counter_running_total}  = 1
              and {status.code} in \[ 208 , 996 ])
    ,0,1)
    When I right-click on the formula field to insert a summary, it does not allow me.
    Do you have any idea I can show the information in a better way ?
    Thanks
    Steph
    Edited by: Stephanie Charest on Aug 4, 2008 8:00 PM

    Thank you very mutch for your reply, I tried it and it works.
    The thing is, I would like to reset the counter on change of group, and put the manual running total in the group footer.
    Is there a formula I could use to reset the counter ?
    When I write in the group header :
    whileprintingrecords;
    numbervar i=0;
    it does not reset the i to zero, instead, it writes "false" and continues to increment in the footer.
    do you have an idea ?
    Thank's
    Steph

  • How to use the distinct key in formula field in SAP Crystal Reports

    I want to use the distinct key in formula field in SAP Crystal reports.
    When i'm using it shows an error.
    Please suggest me....

    Hi,
    Use DistinctCount keyword directly for your calculation instead of count(distinct(....
    Alternatively, if you want to avoid duplicate records, under "File" > "Report Options" make the 'Select Distinct Records' as True.
    Thanks,
    Raghavendra

  • What version of Flash Player should I use with my Power PC based Mac?

    I did the following (see below from a Recent Forum) - and even got a sucessful INSTALLED, but when I go to YouTube....I can not get anything and I am asked to update FLASH.....thoughts?
    What version of Flash Player should I use with my Power PC based Mac?
    Please follow these instructions for installing the most recent version of Flash Player that supports PowerPC based Macs
    1. Follow the instructions for uninstalling Flash Player on the Mac: Uninstall Flash Player
    2. Download and extract the Flash Player 10.1.102.64 zip file
    3. Navigate into the folder "/Flash Player 10.1.102.64/10_1r102_64/"
    4. Mount the file "flashplayer10_1r102_64_ub_mac.dmg" by double clicking
    5. Install using the normal procedure

    I was finally able to successfully installed FP on my Mac OS 10.5.8 using the last trick shown below by Chris (Adobe Flash Player.pkg file). This, only after several (at least 10) attempts, and only after restarting my computer after downloading the install file. Thanks for the helpful post.

  • Can you use a formula field as the default value of a parameter?

    I'm wondering if you can use a formula field as the default value of a parameter. I have an date parameter that is being pulled from a stored procedure. When I run the report, it defaults to the current date and time. I would like it to default to he current date and have the time be 00:00:00

    Hi,
    Unfortunately, you cannot use a formula field as the default value of the parameter.
    And, to get rid of the current time and show 00:00:00, all you need to do is Edit the parameter and set the 'Default Value' to 00:00:00. This will take care of the time portion, however the date portion would be set to the year 1899 and not the current date.
    Hope this helps!
    -Abhilash

  • Selecting records based on formula fields

    Post Author: Mike Kennedy
    CA Forum: Formula
    I have created a field (called "Shortage") that is the result of subtracting two running totals and have inserted all three fields into the group footer.  I only want to select those records that have a negative value as a result, but the field is not shown in the Select Expert.  None of my formula fields show up in the Select Expert for some reason (normally they do).  Does anyone know why and how can I select these records only?  Thanks.

    Post Author: SKodidine
    CA Forum: Formula
    Running Totals are only available once the records are being read and processed.  You are calculating the difference between two Running Totals and then want to use that to select records?  I don't think that is possible.  One way of accomplishing the display of groups which have a negative value is to use sum functions instead of the running totals and then in group selection criteria, display only those groups which have a negative value as a result of subtracting the two sums.

  • Using Case statement instead of IF in formula fields

    Hi,
    Can I use Case statement instead of IF in formula fields?If yes,please specify the syntax.
    regards,
    sunitha

    Hi Sunitha,
    You can surely use case statement instead of the If statement. The syntax for the case statement is :
    Select [1 To n]
      Case "Condition a", "Condition b":
               "c"
      Case "Condition d","Condition e":
                "f"
      Default:
    Hope this helps you!
    Regards,
    Anindita

  • What is the use of  fox formula in integrated planning

    what is the use of  fox formula in integrated planning

    Hi,
    just as a follow up - the FOX Extension Formula capability of the IP in BW is as others have mentioned - to help develop formulas to execute calculations during planning, forecasting, budgeting, etc. - it allows consultants, like myself, to develop these formulas without the help of an ABAP consultant - but creates ABAP programs behind the scenes.
    You can also use these ABAP programs separate from the IP component - once you create a FOX formula you can retrieve the ABAP program and then use it for other activities.
    With the FOX you can use variables in a formula, call another ABAP program, generate loops of data both master and transactional, allows IF, THEN statements, and a number of other activiities. There is a limit to the usefulness of the FOX formula process - you may find if the FOX formula is too complex or long that your process will run slowly during the calculations. If this is occurring you will need to debug your ABAP program to see if you can increaase the performance.
    Thanks and hope this helps, Pete

Maybe you are looking for

  • External Mounted Hard Drive Icon Not Showing on Desktop nor on Sidebar

    Bonjour, I have a portable drive that does NOT show up in the Sidebar nor on the Desktop. The only way I can see and navigate through it is by clicking in Disk Utility > Mount Point: <hyper-link> Then hard drive icon and its content show up fine. But

  • Acrobat 9:  Read-only errror on second save

    I can save a file for the first time in using Adobe Acrobat 9 without any problem.  If I then re-open the same file, make a change and try to save it again, I receive the error message the file is read-only or in use by another program.  This occurs

  • Mac Freezes when i try yo open AVI files

    Hi I have a problem trying to view AVI files. When i open the file everything freezes, i am unable to force quit and have to hit the big off switch. Quicktime did not even open Read a few forums and thought quick time did not have the codecs. Downloa

  • How to get Adobe form element

    Hi Guru, How can i get adobe element Ex: I have one dropdwon List with Name : List1. I want get the value of <b>List1</b>. Like-----weContext.currentDataElemet.getMaterial(); like that i need to get <b>List1</b> value. this element is not bind.  dyna

  • HP d5560 Wireless Issue - No IP Address (Mac OS 10.9)

    Hi there, I recently moved house. In my previous house I had my printer set-up and working wirelessly. I've moved and now have a new Wireless hub and I can not get my printer to connect with my Virgin Media Super Hub. I have tried doing the one-touch