How to Print specific row in each page Crystal Report - crystal-reports

whileprintingrecords;
global numbervar DetailCount;
DetailCount := DetailCount + 1;
Global numbervar DetailCount;
DetailCount Mod 10 = 0
IF Remainder (RecordNumber, 8) = 0 THEN
TRUE
ELSE
FALSE
IF Remainder (RecordNumber, 8) = 0 and not OnLastRecord THEN
TRUE
ELSE
FALSE
i have try this codes but not get it.

Please describe better what you would like to print on each page.
I'm guessing you would like to print a summary that would only show the sum of one printed page.
You need 3 formulas:
sum_pagesum (should be placed in the details-section as hidden field):
whileprintingrecords;
numbervar pagesum;
pagesum:= pagesum + {WHATEVER};
current_pagesum (should be placed in the page-footer-section, this prints your sum):
whileprintingrecords;
numbervar pagesum;
pagesum;
reset_pagesum (should be placed in the page-footer-section after the current_pagesum)
whileprintingrecords;
numbervar pagesum;
pagesum:= 0;

Related

If Else text does not appear to be part of the formula

I am having trouble with if-else syntax. The error says the remaining text does not appear to be part of the formula. How can I resolve this?
NumberVar k:={#Counting_Data}/{#Counting_Fail}
if k > 2 then
StringVar l:="Failed"
else if k <= 2 and k>0
StringVar l:="Promoted"
else if k = 0 then
StringVar l:="Passed"
else ""
NumberVar k:={#Counting_Data}/{#Counting_Fail};
if k > 2 then
StringVar l:="Failed"
else if k <= 2 and k>0 then
l:="Promoted"
else if k = 0 then
l:="Passed"
else ""

Crystal Reports Formula Variable not reset to 0 in Group

I am creating a report...
Its a kind of Ledger Report..
I am displaying the report Groupwise by Name.
See the below image displaying the error...
Now see the red marking in the image...
I created the formula shown below..
d_ClosBal
WhilePrintingRecords;
NumberVar ClosBal1;
ClosBal1 := 0;
ClosBal1 := Sum({#DebitAmt}) - Sum({#CreditAmt});
IF ClosBal1 > 0 then ClosBal1 else 0;
c_ClosBal
WhilePrintingRecords;
NumberVar ClosBal1;
ClosBal1 := 0;
ClosBal1 := Sum({#DebitAmt}) - Sum({#CreditAmt});
IF ClosBal1 < 0 then ClosBal1 else 0;
And Placed formula in the yellow mark shown in the figure below...
The Sum({#DebitAmt}) is 5740.00 and Sum({#CreditAmt}) = 800.00 shown in figure
The blue marked are the Transactions, ex 1000.00, 945.00, etc....
I even tried putting a formula reseting the value of ClosBal1 to 0 inside GroupHeader but ain't helped.
Suggest me any solutions..
you need to indicate your group levels in this statement otherwise you are just grouping the entire report.
ClosBal1 := Sum({#DebitAmt}) - Sum({#CreditAmt});
example
ClosBal1 := Sum({#DebitAmt},{companyname}) - Sum({#CreditAmt},{companyname});

Crystal Reports Prevent global variables from resetting on new page

Is there any way to prevent the resetting of variables on a new page?
In GH2 I initialize the following variable:
WhilePrintingRecords;
Global NumberVar RCountDaysInDenominator := 0;
In GF3:
EvaluateAfter ({#IsEndExamPopulated});
if {#IsEndExamPopulated} = True
then
NumberVar RCountDaysInDenominator := NumberVar RCountDaysInDenominator + 1
else
NumberVar RCountDaysInDenominator := NumberVar RCountDaysInDenominator + 0;
I didn't realize that when a single GF3 spans many pages, these variables reset.
Any suggestions? Thanks in advance!

crystal report: print missing records

i want to print missing records in crystal report .
i am using below formula in the report and i have placed this formula in details b section.
details a has normal report fields.
formula:
local numbervar firstemp; // first Emp#
local numbervar nextemp; // next Emp#
local numbervar diff; // difference between firstemp and nextemp
local numbervar increase; // increment for missing Emp#'s
local numbervar result;
increase := 0;
firstemp := tonumber({getRptSalesSummery;1.Bill_Id});
nextemp := tonumber(next({getRptSalesSummery;1.Bill_Id}));
nextemp := nextemp -1;
diff := nextemp - firstemp;
if nextemp = firstemp
then ""
else (
while diff >= 1
do (
diff := diff - 1;
increase := increase + 1;
result := firstemp + increase;
exit while;
);
totext (result,"0000") & chr(13);
)
this formula is not giving me range.
for example if in report there is range of 1 to 10 and 6,7,8,9 is missing records, then if i check in the report its printing 1 to 5 and 6 as missing then directly 10, but its not giving me 7,8,9.
basically i required range of missing records

Crystal Reports Formula to generate a random number

Let assume
x = 1001
Now I am inputting x to my code and generating y in the following order:
Length of 1001 is 4 so starting from the last number
i.e. 1(number) * 4(position of number) & 0 * 3 & 0 * 2 & 1 * 1 that gives a new number 4001
Another eg. 1234 gives 16941
In crystal I am creating a formual as follows:
stringvar tmp_EventNo;
stringvar tmp_Password;
numbervar i;
numbervar m_password;
tmp_EventNo = Trim(ToText({GR_EVENT.event_number}));
For i := Len(tmp_EventNo) To 1 Step -1 Do
(
tmp_PassWord = tmp_PassWord & Trim(ToText(Val(Mid(tmp_EventNo, i, 1)) + i));
);
m_Password = Val(tmp_PassWord);
m_password
But it doesnt seem to work. Just results in 0.00
Please help thanks in advance
Nice easy one- you will kick yourself :)
In Crystal = is used for evaluation. := is used for assignment.]
There were a few other issues with the code so i tweaked it for you:
stringvar tmp_EventNo;
stringvar tmp_Password;
numbervar i;
numbervar m_password;
tmp_EventNo := Trim(ToText({GR_EVENT.event_number}, 0, ''));
For i := Len(tmp_EventNo) To 1 Step -1 Do
(
tmp_PassWord := tmp_PassWord & Trim(ToText(Val(Mid(tmp_EventNo, i, 1)) * i,0));
);
m_Password := Val(tmp_PassWord);
tmp_PassWord;