Quantcast
Channel: Crystal Reports
Viewing all 1507 articles
Browse latest View live

Report Generation Using Crystal Report

$
0
0

Error Showing Like This 

{"Message":"An error has occurred.","ExceptionMessage":"Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.","ExceptionType":"System.IO.FileNotFoundException","StackTrace":"   at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()\r\n   at EasyBilling.Controllers.Webapi.DealerController.GetDealerListReport() in F:\\EasyBilling\\EasyBilling\\EasyBilling\\Controllers\\Webapi\\DealerController.cs:line 253\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}

How to Print Crystal Reports with parameters

$
0
0

Hello,

 I have two options for my report, sending it to the viewer or sending it directly to the printer.  I have managed to get the parameters passed when using the viewer, but it just wont work when going directly to print.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Private mReport As ReportDocument

mReport = New ReportDocument()
mReport.Load("MYreportName and PathHere.rpt")
dim  strDB = "tableNameHere"

dim WONum as string = "123ABC"

If printFlg = "YES" Then   'printFlg set and defined somewhere else
mReport.SetParameterValue("WONum", WONum)

mReport.PrintOptions.PrinterName = "PrinterName"
mReport.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize
mReport.PrintToPrinter(1, False, 0, 0)

Else
'** Parameter Settings ***'
Dim paramFields As New CrystalDecisions.Shared.ParameterFields()
Dim paramField As New CrystalDecisions.Shared.ParameterField()
Dim paramRange As New CrystalDecisions.Shared.ParameterDiscreteValue()

paramField.ParameterFieldName = "WONum" ' Parameter Name In Crystal Report
paramRange.Value = WONum  ' value For Parameter Field
paramField.CurrentValues.Add(paramRange)
paramFields.Add(paramField) ' To add parameter in parameterslist

CR1.ParameterFieldInfo = paramFields 'to pass parameter inf.to CRV
'*** Parm Settings End ***'

CR1.ReportSource = mReport
End If

sorry, wasnt sure how to add the code.  Anyway, when it goes to directly to printer after I have published the solution, it says missing parameter value, but if I run it on the development computer it works fine.  Do I have syntax errors or am I missing a library?  

I get the following warnings when I publish but dont know if they are the issue or if I can just ignore them.  Any feedback will be just awesome!!

thanks!

>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4935,5): warning MSB3162: The 'SAP Crystal Reports Runtime Engine for .NET Framework' item selected requires 'Microsoft.Net.Framework.2.0'. Select the missing prerequisite in the Prerequisites Dialog Box or create a bootstrapper package for the missing prerequisite.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4935,5): warning MSB3162: The 'SAP Crystal Reports Runtime Engine for .NET Framework' item selected requires 'Microsoft.Data.Access.Components.2.8'. Select the missing prerequisite in the Prerequisites Dialog Box or create a bootstrapper package for the missing prerequisite.

Not sure if I need to install some Crytal dev environment or a NuGet package

$
0
0

I've been working on refactoring an old ASP.NET website (changed to web application) for a while now. To make a long story short, these changes have resulted in me replacing some CrystalDecisions references (since they were broken) with NuGet packages. One of them is for CrystalDecisions.CrystalReports.Engine. If  you go to that web page, you'll see that it says, "This package has no dependencies.". Well, when I finally got it so that it would build, I thought I was done. Running it though and testing it proved otherwise. The error I got is:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
Source=CrystalDecisions.CrystalReports.Engine
StackTrace:
at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
at CrystalDecisions.CrystalReports.Engine.ReportClass..ctor()
at timetrackreports.rpt_tt0002..ctor() in I:\WebSites\FPTimeTracker\FP Timetrack\timetrackreports\rpt_tt0002.vb:line 25
at timetrackreports.rb0002.MakeReport(ReportParameters ps, String ConnectionString, String EnvironmentString) in I:\WebSites\FPTimeTracker\FP Timetrack\timetrackreports\rb0002.vb:line 9
at ReportPrinter.Page_Load(Object sender, EventArgs e) in I:\WebSites\FPTimeTracker\FP Timetrack\TimeTrackSite\ReportPrinter.aspx.vb:line 29

Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

At this point I did some searches and I found some posts on Stack Overflow that recommended installing the Crystal development environment on my dev machine. However, I also found a NuGet package forCrystalDecisions.ReportAppServer. I'm wondering if I should pursue that or if I should instead install the Crystal dev environment? (Assuming we have a license for me to use and I can figure out which version of Crystal this old app used.)

Crystal Reports if "Set To Null" checked an export does't work

$
0
0

Hi Guys,

I develop the reports using Crystal Reports 2013 and then publish them to an asp.net app with crruntime 13.0.5 to show them. I use stored procedures to extract data for reports.

The problem: if even for 1 parameter "Set to Null" option checked, the export to any format doesn't work (just nothing happens) and after each turning of the page of the report the filter's panel appeared again.. Please give me a hint how to fix it?

RDLC If expression return #Error when data available

$
0
0

Hi Guys, 

my RDLC expression return #Error when data available,

when no data i got "Never Register" but when data available i got #error ?

please tell me whats wrong with my expression ?

=IIF(First(Fields!regisration_date.Value, "dataset_registration") = "", "Never Register", First(Fields!regisration_date.Value, "dataset_registration"))

Thankyou & Best Regards,
Wibowo Wiwit.

Invoice Using Crystal Report

$
0
0

Hi,

I am working on ERP in Asp.net web form and crystal Report for generating Invoices. But I am facing a problem while displaying out put , ie, It automatically duplicating each data on page and Listing whole table data , the image link added below.

 https://imgur.com/a9DCRYL

Note: Creating new connection using "ODBC(RDO)" and it was success.

          Visual Studio 2017 and SAP Crystal Reports 2016.

         

How to print Multiple copies of a label in crystal report using parameter of copies ?

$
0
0

I want to print label in crystal report with number of copies by user input parameter (For example i want to print text on label like (AAA0001) 50 times ,then user will input 50 in a textbox then label print 50 times means user will define range of copies to be print in crystal report and also number of pages must be define on each label print.

i am using asp. net c# web form...please guide ,,,

Crystal Report hangs indefinitely in Load in IIS server and only restart after pool is changed/ IIS restarted

$
0
0

Hello

We are using VS 2015 , ASP.NET Ver 4.6  and Crystal Report 13.0.13. The crystal report load event hangs indefinitely after some printouts on function  "  objrep.Load(FileName) "

We had checked for following points 

1)   Crystal report is properly closed  and disposed. (Infact we have created Singleton class for loading so we know there are not more than 5 objects at any given time. If more than 5 objects we had we simply close all before starting new report)   

2) Windows\Temp folder has full permissions 

3) We have selected "No Printer" in the Page Setup.

When doing load testing some time we are able to print more than 200 reports at a single go, but when it starts to get hanged on " .load" then it does that forever and only way to rework is to either restart the IIS or change the application pool for that particular website. (Also one strange problem during load testing also noted that before crystal report started to hang, it gives wrong RTF formatting, once after restart the same report comes good)

Can somebody help us what to check next. (and when we do load testing in our development environment I am able to print more than 1000s of report without getting any hangs)


Barcode 39 issue

$
0
0

Crystal 2013 SP12.

When I run a report with a barcode 39 font it work correctly

2 fields 1) Number  2) Text of any kind.

When I run through a run time version of Crystal in an app that I have no control over other than adding the report

the number field data prints correctly but the text does not.

the text looks like a mix of barcodes and characters where the numbers are the barcode.

If I export to PDF it is correct.

Any idea on a fix?

Show (Label control) inside (Repeater control) at Timer tick

$
0
0

Summary of the problem I am having:

i have repeater that show questions and 4 option of answer , i want to show correct answer after one minute

Error I am receiving:

i can't abel to show CorrectAnswer after one minute

My code:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime" runat="server" />
<br />
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate >
<div class="panel-heading">

<div class="panel-title btn-label q-border">
<h3 class="Golden-color"><span class="label label-success" style="margin-left:10px;" id="qid"><%# Eval("Category") %></span><%# Eval("Question") %></h3>
</div>
<h2 id="counter" class="Golden-color"></h2>

</div>
<div class="panel-body card ">

<div class="quiz" id="quiz" data-toggle="buttons">
<label class="element-animation1 btn btn-lg btn-transparent btn-block"><span class="btn-label"><i class="glyphicon">أ</i></span> <input type="radio" name="q_answer" value="1">
<%# Eval("OptionA") %>
</label>
<label class="element-animation2 btn btn-lg btn-transparent btn-block"><span class="btn-label"><i class="glyphicon">ب</i></span> <input type="radio" name="q_answer" value="2">
<%# Eval("OptionB") %>
</label>
<label class="element-animation3 btn btn-lg btn-transparent btn-block"><span class="btn-label"><i class="glyphicon">ج</i></span> <input type="radio" name="q_answer" value="3">
<%# Eval("OptionC") %>
</label>
<label class="element-animation4 btn btn-lg btn-transparent btn-block"><span class="btn-label"><i class="glyphicon">د</i></span> <input type="radio" name="q_answer" value="4">
<%# Eval("OptionD") %>
</label>
<asp:Label ID="LblCorrectAnswer" runat="server" Visible="false" Text='<%#Eval("CorrectAnswer")%>' CssClass="label label-success"></asp:Label>
</div>
</div>
</ItemTemplate>

</asp:Repeater>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>"
SelectCommand="SELECT TOP 1 * FROM Questions ORDER BY NEWID()"></asp:SqlDataSource>
<asp:Timer ID="Timer1" runat="server" OnTick="TimerTick" Interval="10000" Enabled ="true" />
</ContentTemplate>
</asp:UpdatePanel>


Protected Sub TimerTick(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim lbl As Label = TryCast(e.Item.FindControl("LblCorrectAnswer"), Label)
lbl.Visible = True
End If
Timer1.Enabled = False
End Sub

Barcode sticker deisgn using crystal report 7cms width and 3cms height

$
0
0

I would like to design 7cms width and 3cms height barcode sticker. Kindly let me know how to design the same.

What page setup i need to use? etc.

CrystalDecisions.ReportAppServer does not exist

$
0
0

Hi guys

I've deployed a website to a client and I'm getting : "The type or namespace name 'DataDefModel' does not exist in the namespace 'CrystalDecisions.ReportAppServer' (are you missing an assembly reference?)" Error?

I've deployed the same website to two similar client in Server 2012 R2 and all worked but with this last client with the same platform I've installed (enabled) IIS and I was getting an error regarding reference not found related to crystals so I removed all Crystal report references webconfig (<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>) and got the website running But not I'm getting the above error in relation to CrystalDesicions namespace not found?

FYI, I've also installed : CRRuntime_64bit_13_0_4  and CRforVS_redist_install_64bit_13_0_20 but didn't make any differences, and if I put back the refrences to the webconfig I get the Crystal report reference version error?

And the reason why I removed the references from the webconfig because I thought as long as I got the Crystaldesicion DLLs in the Bin folder plus Crystal runtime install it won't need the references in the webconfig !?   

any help pls?

thanks

if-else condition

$
0
0

Hi

  I want to know how the below code works & what is ext

if {Po.No} >= 1000 then " Po" + ext({Po.No}-1000,0)

else
if {Po.No} > 0 then " PO-1" + ext({Po.No},0);

Thanks

Code working

$
0
0

Hi

  How the below code work

stringVar s0 := "";
numberVar n0 := 0;
numberVar ctr := 0;

if not isnull({List1.ColC}) then s0 := trim({List1.ColC});

n0 := instr(s0, " ");
if n0 > 0 then while mid(s0, n0 + ctr, 1) = " " do ctr := cnt + 1;
if ctr > 2 then s0 := replace (s0,space(ctr),chr(13));

ctr := 0;
n0 := instr(s0, " ");
if n0 > 0 then while mid(s0, instr(s0, " ") + ctr, 1) = " " do ctr := ctr + 1;
if ctr > 2 then s0 := replace (s0,space(ctr),chr(13));

Thanks

Export Crystal report viewer to excel

$
0
0

Hi Guys,

Using the export button on crystal report viewer in IE to CSV format gives me the options to either save or open the file directly and works fine but if I choose Excel it gives me the same Open or Save but if I choose the open option I get "the file is corrupted and cannot be opened " error ?

it works five if I save then open the file, but not if i choose the Open file directly.  

FYI, this funtion works file in my machine or other clients, but not for this specific client.

any help pls?

Thanks


how to Print on client side in asp.net c#

$
0
0

i want to print on client side ,currently below mentioned code working on server ,where i published my application,when i am giving print from client side ,then print is coming on server printer but i want print on client printer not on server.

protected void btnprnt_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(txtqty.Text) > 0)
            {
                try
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("sp_Importlabelprint", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    //SqlDataAdapter adp = new SqlDataAdapter("select prdno,orderno,Codeitem,prdqty from probale", con);
                    //DataSet ds = new DataSet();
                    //adp.Fill(ds);

                    for (int i = 0; i < Convert.ToInt32(txtqty.Text); i++)
                    {
                        ReportDocument rpt = new ReportDocument();
                        rpt.FileName = Server.MapPath("~/Importlbprint.rpt");
                        rpt.SetDataSource(ds.Tables["Table"]); //DS is Dataset which you want to print

                        rpt.SetParameterValue("PageNo", i + 1);
                        rpt.SetParameterValue("TotalPage", Convert.ToInt32(txtqty.Text));
                        rpt.PrintToPrinter(1, false, 1, 1);
                    }
                    string url = "/lbimportprints.aspx?noc=" + txtqty.Text;
                    Page.ClientScript.RegisterStartupScript(
                 this.GetType(), "OpenWindow", "window.open('" + url + "','_newtab');", true);

                }

                catch (Exception ex) { }

            }
        }
    }

Search for file on drive including subfolders matching a record/fieldname (with wildcards)

$
0
0

<div class="dm-section-hero--question__content"> <div class="dm-section-hero--question__body">

I have a question about crystal reports 11.5.8.826

I’m trying to locate a file on a server folder matching a fieldname with the result TRUE or FALSE.

I would also like to use wildcards.

For example :

401 = fieldname

search for 401*.cnt on a server location: \\svrfil01\drawing\

result:

401part1.cnt and 401part2.cnt / output = TRUE

I already used a custom UFL function “filexists()“ but that does not allow wildcards and does not search in subfolders.

found it here here : http://www.viksoe.dk/code/u2lwin32.htm

And I tried using a new database connection, but that messes up my report results and causes to slow down the report :

Is it possible to do this without a function or a database connection?

If not, can you please tell me if there is a correct function or how to connect with a drive on the server?

Thank you all.

</div> </div>

how can distinguish between automatic report and manuel excel report

$
0
0

with my asp.net mvc application i use reporting tools for generating an automatic report so that users can automaticly get reports from web application. but some users use a excel for establish reports similars of the automatics reports

the problem is that users can create and print reports reflect exactly to data in the database so we can not distinguish between them

the users in past can inputs thier data in excel but since the application is made, the data is displayed automatically without input

i want to know what is the thing that i can  learn to put it in automatic database report and can't be put in manuel excel

Unable to export to PDF in Firefox Quantum / Chrome

$
0
0

Basically, on our website we have a report that lets you export to pdf, excel or just as html.

​Things work fine on older browsers (ESR 60), Edge and IE. New versions of Firefox and Chrome will not work with the pdf or excel option.

Html works just fine, but the other two seem to download a temp file as getparms.aspx and then rename it - the two mentioned browsers no longer seem to allow that file to be downloaded (download failed) and renamed in the users temp folder (probably good for security). 

From some googling, it seems it could be related to memorystream being used?  Most examples I have seen use embedded CR into the aspx page, which doesn't apply to this case.

I have been trying a few different things, but everything has failed so far - I'm not a programmer, just trying to fix what was left behind.

I am including the code for the page that generates the files

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Web

Partial Class IndexReport_GetParms
    Inherits System.Web.UI.Page
    Dim blayer As New BAL

#Region " Page_Load "

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim PlantID As Integer = blayer.PlantId
        Dim rptName As String = Request.QueryString("ReportName")
        Dim format As String = Request.QueryString("Format")
        Try

            Me.CRSource.Report.FileName = "testreport.rpt"
            Me.CRSource.ReportDocument.SetDatabaseLogon("test", "test1")
            'Me.CRSource.ReportDocument.SetParameterValue(0, 0)
            Me.CRSource.ReportDocument.SetParameterValue(0, PlantID)
            'Me.CRSource.ReportDocument.SetParameterValue(2, rptName)

            Dim ms As IO.MemoryStream
            Select Case format
                Case "PDF"
                    ms = Me.CRSource.ReportDocument.ExportToStream(ExportFormatType.PortableDocFormat)

                    Response.Clear()
                    Response.Buffer = True

                    Response.AddHeader("Accept-Header", ms.Length.ToString)
                    Response.ContentType = "application/pdf"
                    Response.OutputStream.Write(ms.ToArray(), 0, Convert.ToInt32(ms.Length))

                    Response.Flush()
                    Response.Close()

                    ms.Close()
                Case "EXCEL"
                    ms = Me.CRSource.ReportDocument.ExportToStream(ExportFormatType.Excel)

                    Response.Clear()
                    Response.Buffer = True

                    Response.AddHeader("Accept-Ranges", ms.Length.ToString)
                    Response.ContentType = "application/vnd.ms-excel"
                    Response.OutputStream.Write(ms.ToArray(), 0, Convert.ToInt32(ms.Length))
                    Response.Flush()
                    Response.Close()

                    ms.Close()
                Case "HTML"
                    ms = Me.CRSource.ReportDocument.ExportToStream(ExportFormatType.HTML40)

                    Response.Clear()
                    Response.Buffer = True

                    Response.AddHeader("Accept-Ranges", ms.Length.ToString)
                    Response.ContentType = "text/HTML"
                    Response.OutputStream.Write(ms.ToArray(), 0, Convert.ToInt32(ms.Length))

                    Response.Flush()
                    Response.Close()

                    ms.Close()
            End Select

        Catch ex As Exception
            Throw ex
        End Try
    End Sub

#End Region


End Class

Ideas? 

Update - Again, I'm sure related to how it tries to download the .aspx file, this is the error being thrown when trying to export to pdf

"Resource interpreted as Document but transferred with MIME type application/pdf"

I can change application/df to text/HTML and it will display - as gibberish of course.

Date Format

$
0
0

Hi

  How to set Date Format to dd/MM/yyyy

Thanks

Viewing all 1507 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>