Sunday, 5 February 2017

Crystal Report... Displaying Serial Number based on the Condition

                                            I was working on a client project in which my part is to design report’s based on crystal report. In this I got a interesting requirement from client side. According to that, I have to insert serial number in the report for particular table row based on some condition, and I want to skip the serial number if that condition is fail’s.












Above image shows the normal report output… but I have to display report like …


Here , my condition is based on ‘Bill No ’ column . If Billno column has any value the serial no column should have the value … otherwise the s.no column should skip the value…
Based on this, I wrote the condition in formula  block..



So, here my condition is , to check whether the column “Bill_no” has any value or null …
If the column “Bill_no” is null or no value , no value taken place in S.no column in report..
Else
It'll display the S.no with increment..


Note: here I used Totext keyword… Because it return only string or char value .. so I used Totext keyword..  
We can use this totext in two format …if I use like  Totext(srno:=srno+1,0) the S.no will display like 1,2,3,4…. Else if use like Totext(srno:=srno+1) the S.no will Display Like 1.00,2.00,3.00,4.00 …….

To Disable that decimal value we have to use “Totext(srno:=srno+1,0)”… 0 indicates number of decimal’s to print after dot…

That’s it..