Grouping a report by a formula field
Post Author: triley01
CA Forum: Crystal Reports
Hello, I am really stuck on this one. I have a report that sums values in Activity.Product_Code field. Based on those values I have created a n IF Else formula that displays a string based on the total. For example, if the sum of Activity.Product_code is less thatn 1000 the string displayed next to the record is 'contributor', if Activity.Product_code greater than 1000 but less than 2000 the string is 'attache' and so on. Its a report that shows level recognition. The part I can't figure out is how to group by this recogition level and have the report prompt for a level. When I select Insert-Group in Crystal the formula I created is not shown as an available field to group on. Hope this makes sense. Any help would be GREATLY appreciated! thanks in advance. Tim
Post Author: triley01
CA Forum: Crystal Reports
I think I am getting closer. I converted a formula to a CASE statement for an SQL expression (see below). However I am still getting a "Incorrect syntax near the keyword FROM" error when trying to save it in Crystal
Again any help would be greatly appreciated!
select ID,
case
when sum(amount) > 0 and sum(amount) < 1000 then 'Contributor'
when sum(amount) >= 1000 and sum(amount) < 2500 then 'Attache'
when sum(amount) >= 2500 and sum(amount) < 5000 then 'Envoy'
when sum(amount) >= 5000 and sum(amount) < 10000 then 'Diplomat'
when sum(amount) >= 10000 and sum(amount) < 25000 then 'Ambassador'
when sum(amount) >= 25000 then 'Inner Circle'
else ''
end as [Description],
sum(amount) as [Amount]
from activity
where activity_type = 'GIFT'
group by id
Similar Messages
-
Not able to clear out a formula field value when variables are equal to 0
I am trying to calculate the difference between a formula field from a main report and a formula field from a subreport. When i run the report i get a correct difference calculation only when both formula fields have a value different than 0. When both values are 0 then the difference calculation shows the last item quantity from the formula field in the subreport that had different values than 0. It looks like the difference calculation is not being clear out before jumping to the next value calculation.
try to clear the variable values once done with calculation like
whileprintingrecords;
shared numbervar i:=0;
regards,
Raghavendra -
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 -
How can we pass a formula field of Main report to SubRepor's Parameter. in CryastlReport 11
Post Author: Nikhil
CA Forum: General
Hi
Crystal Report version : 11.0.0.1282 Standard
There is MainReport1. Other is Subreport1
Scenario :
MainReport1 having paramater PdateMain1 as dateTime.
SubReport1 having parameter dateSub1 ,dateSub2.
datesub1 is used for One datasource1 (DataSource- XML -from webApplication) , dateSub2 is used for datasource2 (DataSource-SQl Procedure ) ( This is requirement as i need to used two datasource )
Value of datesub1 and datesub1 is same (it is created automatical as it is part of SQLProcedure and XML Query ) but get prompted twice for the same valuewhich is not desirable. so for that i have created main report and calling this subreport in main report.
Now i want's to pass PdataMain1 to Parameter datesub1 and datesub2. I am able to pass PdataMain1 to datesub1. through Change Sub report link ( Option on right click of report).and it is working fine,
Problem :
But Subreport link Menu does not allow to bind PdateMain1 to datesub2 as it is allready bind with datasub2.
to overcome this i created one Formula field in main report as fMaindate1 which copy date from Parameter PdateMain1.and bind ( link) the fMaindate1 to datesub2. when i link this , subreport does not display any thing at all. It it a limitation of crystal report or i am missing some thing , Is it like that we can pass formula of ,main report to subreport Paramater in Crystal 11 Standard , if we can anyone please Provide help on this.
This can be easily achieve through application programming but my need to get this done in Report itself.Thanks
Nikhil PatelPost Author: Jagan
CA Forum: Crystal Reports
Shared variables. Looked in the help at variables - shared -
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 YouThanks 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 appreciatedHi 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 to apply formula field for a chart object in crystal report XI
Hi
how to add formula field for a chartobject, i tried the following code but returns invalid condition field.
i want to show different chart in same crystal report viewer with different coursestatus values.
please suggest where ia m wrong.
FormulaField oFormulaField;
oFormulaField = new FormulaField();
oFormulaField.Name = "Status1";
oFormulaField.Text = "{CSP_PROCESS_REPORT.Coursestatus} = 'Mastered'";
oFormulaField.Syntax = CrFormulaSyntaxEnum.crFormulaSyntaxCrystal;
oFormulaField.Type = CrFieldValueTypeEnum.crFieldValueTypeStringField;
boChartObject.ChartDefinition.ConditionFields.Add(oFormulaField);
regards,
Padmanaban Vi missed the following line in my code.
rcDoc.DataDefController.FormulaFieldController.Add(oFormulaField);
now it works......
my next issue is that,
chart returns True & False captions. but i want to show actual value. how its to be done
regards,
Padmanaban V -
How to set a new value for formula field in crystal reports xi?
<p>How to set a new value for formula field in crystal reports xi?</p><p>//formula</p><p>{@description}</p><p> </p><p>exemplo in VB6</p><p>crxSubreport.FormulaFields.Item(1).Text = "'Subreport Formula'" or</p><p>crxSubreport.FormulaFields.Item("description").Text = "'Subreport Formula'"</p><p>How to in JRC?</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>
Hi,
This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
Regards,
<p>Blair Wheadon</p>
<p>Product Manager, Crystal Reports</p> -
I am using CR Professional 11.5 on Windows XP/Progress platform.
I have a formula field that calculates the GM% on the Employee Group Footer level and want to sort the employees in descending order by GM%. I have gone in circles trying to calculate this field differently in order to be able to perform a Group Sort but this GM% cannot be summarized, which would allow me to use the Group Sort Expert.
The fact that GM% is used in businesses world-wide each and every day makes this unbelievable that it should prove to be this difficult. Is there something that I am missing as a newbie to CR design?
Any help provided is greatly appreciated!
Marlene HumanThat's so awesome! If only I knew how to use sql commands! Everytime I try to create one it has errors that I dont' understand. Do you know of a site for sql syntax that might help me to do this? I have looked and can't find what I need to make this happen.
So what I need to do is to use 'Formula Workshop' and create a new SQL Expression Field? Using the formula above, how would this look in SQL?
Thank you so much for your help...I am so grateful!!! I have been working on this for months and keep hitting this snag. I first started out using a cross-table and got confused because you can't summarize the GM% so I then changed the summary to 'weighted average of GM% with Tech/Rev' so that helped, but the Total per Employee has been keeping me stumped.
Thanks again. -
How to intercept variables in report's formula field via TOAD?
I have a case in this report. I have a report that generates a list of items with info of their initial stock, stock movements and final stock. no problem for the in and out stock movements.
but there's a slight problem with the initial stock. I wrote a formula field that executes several select queries to obtain the inital stock. The XML report format roughly looks like this:
Item_Name Initial_Stock Stock_In Stock_Out Final_Stock
<?Item_name?> <?CF_Init?> <?In?> <?Out?> <?CF_Final?>
As you can see, the Initial Stock and Final stock data is obtained through a formula field. And the select queries I mentioned above are employed in the formula fields. The rest of the fields are obtained directly from the SQL field in the report. Right now the report generates all items, whether their initial stock is zero or not. What I'm trying to do is not displaying items whose initial stock, stock in, stock out and final stock are zero. thanks
Edited by: 801264 on Oct 14, 2010 9:22 PM
Edited by: 801264 on Oct 14, 2010 10:39 PMWell you could try upgrading to a more recent Java runtime for starters.
This is a native crash, which means something went wrong outside of Java code. The trouble is that you can't know WHERE it happens; The JVM itself is only a client of the machine it runs in and can be made unstable by outside influence. Under Linux it takes only one wonky shared library. It could be a driver. It could be a problem in the kernel. It could be another process. It could be anything.
It could also be a bug in the JVM of course, but the only way you have a right to report it as a bug is if you try to see if the problem persists under the latest update. -
SAP Crystal reports formula fields
hi,
how to use formula fields in crystal report.
thanks & regards,vinothHi Vinoth,
That's a very vague question.
You can create formulae via the Field Explorer > Formula option.
After you save and close the formula editor, you need to drag and drop the formula on the report for it to execute.
If you need help with a formula, please post the requirement.
-Abhilash -
Crystal Report Formula field function on OLAP SAP BI/BW Cube
Dear All
We create OLAP Cube Report in Crystal Report 2008 (BO) base SAP ( DB2) BI/BW Cube, Grid report coming correctly. Crystal Report Formula Field functionalities are not avilabel or suporting. If any one explain or some kind of documentation available pl. help me.
Thanks, in advance.
Alfred.MHi,
you are using the OLAP Grid which will only have limited functionality. You can use the BW MDX Driver and then connect to a BEx query and you will have the complete functionality in CR
Ingo -
How to appear a formula field for once at a fom-like report?
Hi All,
I have created a formula field and then set the property "Maximum Records per page" to the value 12 for the repeating frame containing this field and all other fields.
Now I want to make an exception for that formula field
I want it to be appeared only for one time not 12 times!
how to do this Plz?Hi,
I assume that your formula column is at a higher level than your repeating frame (in other case it's not clear which value you want to display). Bring the filed representing the formula column behind the repeating frame, then it's diplayed only once.
Regards
Rainer -
How to set values of formula fields during runtime in crystal reports
Hello All,
Could any one help in letting me know how to set the values of a formula in the runtime.
I tried using the below systax in the formula field
Assume that I have 2 formula fields
1. format_count
2. format_display
my formula is like below:
in the formula field format_count i have
format_display=pagenumber
when checking for errors its throwing error stating "stamement is expected"
Could any one help in resolving this
ThanksHi Ranjeet,
Whenever you assign values to a variable, you need to use :=
Like this:
numbervar x := pagenumber
And what exactly are you trying to do anyway?
-Abhilash -
Running Total - How to summarize a formula field?
I'm sorry if this comes over as stupid but I have got myself quite messed up and am not 100% au fait with Crystal Reporting.
The aim of my report is to calculate the costs of selected tests and to calculate a grand total of all tests at the end.
I have created a group of jobtests.TestTypeName
Details
1. testTypeName - to show Test Name that is being calcutaed - Database field
2. Count ({jobTests.testTypeName}, {jobTests.testTypeName}) - to show number of tests of that type - this is a formula field
3. Analysis1 - to show the cost of that test type - Database field
4. {@CountTests/TestType} * {jobTests.AnalysisN1} - to show the number of tests per test type mulitplied by the cost of that test type - this is a formula field
Report footer
Count ({jobTests.testTypeName}) - to count the total number of tests
MY PROBLEM - I need to see the sum of 4, this would be my grand total
Trying to run the Running Total I can't get it to Summarize the field 4 because it is a formula field.
What can I do?
Thanks.You can't do a SUM on a formula that uses another aggregate function. However, for both 4 and your grand total, you just need to SUM() (with ",{jobTests.testTypeName}" for the #4 calc), as the database field will be the cost for each test in each record.
HTH,
Carl
Maybe you are looking for
-
Up to yesterday I was using my Apple ID on itunes and the app store. I have a valid credit card on file and $13.44USD store credit. Prior to 28th September 2012 I had $40.42USD store credit on my account. On the 28th September 2012, I subscribed to i
-
SAP Easy DMS Error in Searching a Document.
Hello Guru, A user can log in in SAP Easy DMS, but when doing the search on it he gots error pop-up message "The parameters is incorrect" how can we solve this he cannot search any document in his easy DMS.
-
Well guys, I have a problem here and I didn't find any solutions So maybe someone of you, can help me! My problem is: I have 2 numbers (100 and -200) and I have to plot the greater value. The problem is for me the signal of -(minus) doesn't means not
-
SQL * Loader : Load data with format MM/DD/YYYY HH:MI:SS PM
Please advice how to load data with format MM/DD/YYYY HH:MI:SS PM into an Oracle Table using SQL * Loader. - What format should I give in the control file? - What would be the column type to create the table to load data. Sample data below; MM/DD/YYY
-
Hi, When i configure VS with ANM the ACE gets crashed/reboot automatically. And also i see the ANM geting timedout after 10 minutes and the message i get is 'failed to deploy". Can someone assist me on this. Thanks in advance.