I want to suppress a group if a field does not change within that group. Here is a screenshot of my example data (the two red-boxed fields showing the groups that have the unchanging field):
As you can see the two groups, reservation_number 10002 and 10014, should be suppressed as their amount field does not change.
Ideally the above screenshot should become this:
Please note that there can be more than two amount rows in a group.
Follow below process
Create a formula #Initialize and write below code and place in group header
Shared numbervar counter;
counter:=0
Create one more formula count and write below code and place in detail where you have data rows
Shared numbervar counter;
if PreviousIsNull(amount)
then counter:=counter+0
else if previous(amount) = amount
then counter:=counter+0
else if next(amount) = amount
then counter:=counter+0
else counter:=counter+1
Create one more formula result and place in groupfooter
Shared numbervar counter;
Shared Numbervar counter1:=0;
counter1:=counter;
counter
Go to section expert and supress and write below condition:
EvaluateAfter({result}) ;
Shared numbervar counter;
if counter = 0
then
true
else false
Use below formula for supress of header:
EvaluateAfter({result});
Shared Numbervar counter1;
if counter1 = 0
then
true
else false
Let me know if this works else will suggest other way
Related
I have a variable dItemDesc defined in the Group Footer:
whilereadingrecords;
stringvar DispItemDesc;
DispItemDesc := DispItemDesc + "> " + {Command.ItemDesc}
The display for the first record is correct, but following records just continue to concatenate the string. Where / how would I reset the variable to blank?
Create another formula as a reset. Place it at the stage you'd like it to clear out. (Presumably one section below the current Group Footer, or in the Group Header.)
whilereadingrecords;
stringvar DispItemDesc;
DispItemDesc := ""
I am new to crystal reports.
Here is my data table "PAY_DETAILS".I need to display a "Basic Salary" field in my report.
So I need to check whether the Earn_Type is "CBS" and if it is true then display the CBS amount in the report.How to write this formula.
Amount Earn_Type
--------------------------------
6,789.00 ER006
2,300.00 ER007
7,890.00 ER009
88.00 ER003
88.00 ER004
48,850.00 CBS
8.00 ARS
I tried creating a formula field and drag it to report.But it displays nothing.Below is my formula.
numberVar salAmount ;
if({PAY_DETAILS.EARN_TYPE}="CBS") then
salAmount= {PAY_DETAILS.AMOUNT};
use := instead of equal when assigning a value
numberVar salAmount ;
if {PAY_DETAILS.EARN_TYPE} = "CBS" then
salAmount := {PAY_DETAILS.AMOUNT};
Hi i am new to stack overflow, and I am having a problem in crystal report.
Thank you in advance
I am getting output from database like
Name Qty Rate Amount
Mango ice cream 1 100 100
Chocobar 1 150 150
Zulubar 1 50 50
Chocolate cone 1 50 50
Kulfi 1 100 100
ABC 1 100 100
XYZ 1 50 50
Total:- 600
Now what I want to do is merge first three raw and split on 3rd raw.
I want the output to look like this
Name Amount
Mango ice creame, Chocobar, Zulubar 300
Chocolate cone, Kulfi, ABC 250
XYZ 50
Total:- 600
How can I do this?
Assuming your requirement is static and no dynamic is involved. Follow below process:
Create 3 detail sections, detailA, detail B and detail C
Create a formula #First place it in detail A.
Local Numbervar var_Mango_ice_creame;
Local Numbervar var_Chocobar;
Local Numbervar var_Zulubar;
Shared Numbervar total;
if Name='Mango ice creame'
then var_Mango_ice_creame:= Amount;
if Name='Chocobar'
then var_Chocobar:= Amount;
if Name='Zulubar'
then var_Zulubar:= Amount;
total:=total+var_Mango_ice_creame+var_Chocobar+var_Zulubar;
var_Mango_ice_creame+var_Chocobar+var_Zulubar;
Similarly create 2nd formula #second place it in Detail2
Local Numbervar var_Chocolate cone;
Local Numbervar var_Kulfi;
Local Numbervar var_ABC;
Shared Numbervar total;
if Name='Chocolate cone'
then var_Chocolate cone:= Amount;
if Name='Kulfi'
then var_Kulfi:= Amount;
if Name='ABC'
then var_ABC:= Amount;
total:=total+var_Chocolate cone+var_Kulfi+var_ABC;
var_Chocolate cone+var_Kulfi+var_ABC;
Create 3rd formula #Third place it in Detail C
Local Numbervar var_XYZ;
Shared Numbervar total;
if Name='XYZ'
then var_XYZ:= Amount;
total:=total+var_XYZ;
var_XYZ;
Create 4th formula Display and place in report footer.
Shared Numbervar total;
total;
Create a formula field to be used for grouping purposes:
// {#grouper}
Ceiling(RecordNumber/3)
Add a group on this field.
Create a manual, running-total field:
// {#reset}
// place in group header; suppress
WhilePrintingRecords;
Stringvar Array reset;
Stringvar Array values;
values := reset;
// {#increment}
// place in details; suppress
WhilePrintingRecords;
Stringvar Array values;
Redim Preserve values[Ubound(values)+1];
values[Ubound(values)] := {table.name_field};
// {#display}
// place in group footer
WhilePrintingRecords;
Stringvar Array values;
Join(values, ", ");
I have three global variables. two loose their value when they hit a footer, but the other one does not, and I do not understand why.
1 group header
2 group header (all 3 globals reset)
3 group header
detail (not displayed)
3 group footer (values on globals set and displayed- see the functions below)
2 group footer (attempt to sum all variables together)
1 group footer
when I attempt to sum the globals on 2 group footer, varCccCount is at zero and varFishCsvcCount is at zero, but Varothercount retains it's value.
Any suggestions?
global numbervar varCccCount;
whileprintingrecords;
if left({v_EIS_EECoreCourseReq.COURSEID_I},3)="CCC" then
// this is a CCC course and I want to count it
if isnull (Maximum ({HR2TRA04.DATE1}, {v_EIS_EECoreCourseReq.COURSEID_I}))
then
// this CCC course has never been taken
varCccCount:=varCccCount
else
// has this CCC course expired by the cut off date of the report?
if {#Expires}<{?Cut-off Date} then varCccCount:=varCccCount else
varCccCount:=varCccCount+1
// this is not a ccc course, and I do not want to increase the CCC count
else varCccCount:=varCccCount
global numbervar varFishCsvcCount;
whileprintingrecords;
if {v_EIS_EECoreCourseReq.COURSEID_I}='FISH' OR {v_EIS_EECoreCourseReq.COURSEID_I}='CSVC' then
// this is a FISH or CSVC course and I want to count it
if isnull (Maximum ({HR2TRA04.DATE1}, {v_EIS_EECoreCourseReq.COURSEID_I}))
then
// this CCC course has never been taken. do not increase
varFishCsvcCount:=varFishCsvcCount
else
// has this CCC course expired by the cut off date of the report?
if {#Expires}<{?Cut-off Date} then varFishCsvcCount:=varFishCsvcCount else
varFishCsvcCount:=varFishCsvcCount+1
// this is not a ccc course, and I do not want to increase the CCC count
else varFishCsvcCount:=varFishCsvcCount
global numbervar varOtherCount;
whileprintingrecords;
if not({v_EIS_EECoreCourseReq.COURSEID_I} in ['CCC1','CCC2','CCC3','FISH','CSVC']) Then
// This is NOT a course we are already counting somewhere else, so lets take a look at it
if isnull (Maximum ({HR2TRA04.DATE1}, {v_EIS_EECoreCourseReq.COURSEID_I})) then
// this course has never been taken
varOtherCount:=varOtherCount
else
// has this course expired by the cut off date of the report?
if {#Expires}<{?Cut-off Date} then varOtherCount:=varOtherCount else
varOtherCount:=varOtherCount+1
// This is one of the courses we are already counting in another variable. lets not count it
else varOtherCount:=varOtherCount
i have following data :
Name Amount
================
Amit 18000
Ajay 19500
Bharat 16100
how do i print the name with lowest amount in the report footer.
i tried the following formula
if {table.amount} = minimum({table.amount}) then
'Lowest Vendor - ' + {table.name}
above formula returns a blank value.
I need this in Crystal Reports not in RDBMS.
Take a local variable and store the value in that and use the variable in report footer.
Shared Stringvar a;
Shared Stringvar b;
a:=
if {table.amount} = minimum({table.amount}) then
'Lowest Vendor - ' + {table.name}
else '0';
if a<>'0'
then b:=a;
place this formula beside the amount column.
Create another formula and write below formula and place it in footer
Shared Stringvar b;
b