You must Sign In to post a response.
  • Category: ASP.NET

    How to use "loop" in crystal report

    want to print certain number of values in crystal report..
  • #768623
    Hi,

    For printing certain looping kind of stuff, you can done through the Formula tab of that particular block.
    Suppose its header or footer or any section tab, When you right click that area and choose the formula, we can code it as per our requirement.

    Just say the below code will loop the number until 1 to 10.

    stringvar strCount;
    numbervar i=1;
    For i:=1 to 10 Do
    ( whileprintingrecords;
    numbervar sno;
    sno:=sno+1;
    strCount:= strCount+ ' ' + ToText(sno);
    i=i+1; );
    {?display}=strCount;


    So the above code in the formula tab will make your programming in crystal report to loop. The content which you want to loop will be determined by you.

    Thanks,
    Mani

  • #768664
    You can use this code snippet as example for do loops with Crystal Report
    Local numberVar i;
    Local numberVar pcsLeft := {tblItem.itmPcsLeft};
    Local stringvar outputString := "";
    for i := 0 to pcsLeft do
    (
    outputString := outputString + totext({tblItem.itmCode} + " PHP " + ToText ({tblItem.itmSelling})) + " "
    );
    outputString;


    Reference: http://stackoverflow.com/questions/29275410/how-to-use-loop-for-in-a-formula-in-crystal-report


Sign In to post your comments