Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Sunday, March 11, 2012

Crystal Report Performence Issue

Hi All,

I am new in Crystal Report.net2005.
I have used VB.net Application, Access 2003 as back end database.
I am using dataset for viewing crystal report.

My prob is that:

For th first time my reports are taking too much time to show.
But the next time it's not taking so much time.

It's happening every time when i exit the application.

Please give solution

Thank in Advance

Mayukh.What happens if you run the Crystal generated SQL directly in Access? Is it slow the first time and quicker next time?|||First time to make connection and pull data it takes sometime. But next time it would be faster as connection is already there until you refresh the report

Thursday, March 8, 2012

Crystal Report drives me crazy

Hi,

My company purchased Crystal Report Software two days back only b'coz I requested for it. And now that I started working on it, I am not getting the result what I want. I am really worried as to how am I going to answere to my boss's questions. I even searched the internet SO MUCH, but I couldn't get any help.

Let me tell you what I have done.

I have used unbound fields in the report bcoz I prefer dynamic reports as the system that I am developing is a multiuser system.
I want to display records in Crystal report according to certain criteria that the user picks from a form.

This is my code:

Dim Report As New CrystalReport1
Dim Rs As New ADODB.Recordset

Private Sub Form_Load()

Screen.MousePointer = vbHourglass

Rs.Open "select StaffMaster.[EmpName], StaffHrs.[ATH] from staffmaster,staffhrs where staffmaster.empcode=" & _
"staffhrs.empcode and staffhrs.discipline='architecture' order by empname", Cn, adOpenStatic, adLockReadOnly, adCmdText

Report.DiscardSavedData

Report.Database.SetDataSource Rs

Report.EmpName.SetUnboundFieldSource "{Rs.EmpName}"
Report.ATH.SetUnboundFieldSource "{Rs.ATH}"

CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

End Sub

The error that I get is as follows:

'The field name is not known.'

Any help would be appreciated.

ThanksProbably one of the fields that you are selecting in the rs.open recordset might be wrong. Either there is a spelling mistake or the field is not there in your database. Check it out. Hope this helps.|||I double checked the names and even the upper case and lower case letters. Still the same.

I looped through the recordset to see if it displays the correct data and it is so. This is the loop:

If Not (Rs.BOF Or Rs.EOF) Then
Rs.MoveFirst
Do Until Rs.EOF
MsgBox Rs(0) & " " & Rs(1)
Rs.MoveNext
Loop
End If|||Where exactly in the line of code do you get the error?Debug it and check where you are getting the error. This might help you in
streamlining the code and closing in the problem

Just check whether the code in the following lines is giving a problem

Report.DiscardSavedData
Report.Database.SetDataSource Rs

Report.EmpName.SetUnboundFieldSource "{Rs.EmpName}"
Report.ATH.SetUnboundFieldSource "{Rs.ATH}"



Check out the syntax for the above lines of code and whether the parameters are correctly passed|||When I stepped through the code, I get the error message in the line

CRViewer1.ViewReport

These lines did not show any error.

Report.DiscardSavedData
Report.Database.SetDataSource Rs

Report.EmpName.SetUnboundFieldSource "{Rs.EmpName}"
Report.ATH.SetUnboundFieldSource "{Rs.ATH}"

Thanks|||Do you have any formula fields in the report. If yes then you will have to set the formulas befor you view the report.

Does your report show the details when you preview it through crystal reports? Or are you having any problems in viewing it.

I am not sure whether this will help but just try to set the location of the database to the report and check it out. Even through the try to set the datafiles property of CR.|||Yes, both the unbound fields are formula fields. How do I set the formula?|||This is the code once again.

Report.DiscardSavedData
Report.Database.SetDataSource Rs

Report.UnboundString11.SetUnboundFieldSource ("{Rs.EmpName}")
Report.ATH.SetUnboundFieldSource ("{Rs.ATH}")

CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault|||I normally use to set the formulas as

CR1.Formulas(0) = "Compname = " & CoName

where coname is a variable populated with the company's name in the initial startupcode

Just check whether the below code does set the formulas

Report.UnboundString11.SetUnboundFieldSource ("{Rs.EmpName}")
Report.ATH.SetUnboundFieldSource ("{Rs.ATH}")


Probably it is in thispart of your code the error is there. I am not sure of how to set the unbound fields as formulas. You will have to check out the syntax in your CR help files.

Check whether the field name you have given in the report has to be entered while setting the unbound fields

Hope this helps.|||Thanks for your reply. I found the solution. The code should be like this.

Report.Database.Tables.Add "", , Rs

I have one other doubt too. I have a table which contains the availability percentage and Month_Year of staff. Each staff can have more than one record in the table since one record is for one month. If he is assigned any work for, say, June, he has a record for June in the table. If not assigned, he does not have one. I wish to create a report in Crystal Report where I can see the report of each staff for 6 months in one line. If he does not have a record of any of these 6 months, then his availability should display 100. Can this be accomplished? If so, please help me.

Thanks.|||you can place a formula field where in you can check whether there is a record for that month. if there are no records display 100 else display the availability.

hope this helps|||Yeah! Exactly! That is what I want. But how do I place a formula field with code? Please help.

Thanks|||First Insert a formula field. In the formula editor you can set the conditions like below. You can place the formula field then right click on the field. you will find an option edit formula. click on that option and you can enter the code.

if not IsNull ({Ttest.SoldQty}) then
{@.Unstk}*{PurchaseReg.Rate} else
{PurchaseReg.Amount}|||But I am formatting the report with code, so that I only have to add one report into the project and design the report with code according to the different reports of requirement.

And one more thing. My table called Availability contains one record for every month that the staff is assigned. So how will I get the recordset? Please help.

Thanks|||I am not getting your point. In a report if you place a formula field and put the conditions in it.

you can create the report based on the availability field and the last column instead of the database field can be the derived field.

what do you mean formatting the report with code ?|||I will explain it clearly.

TableName: Availability

Fields:

EmpCode
Discipline
Month_Year
Percentage_of_Availability

One record in this table is for one month. I wish to display the Percentage of Availability in the report for 6 months in one line.

I hope it can be done with formula fields.

Thanks

Wednesday, March 7, 2012

Crystal Report

I am using VB 6 with MS Access as Back End. I saved a path name of a text file in a field of Access MDB. I am using Crystal report 8 for creating reports. Will anybody help me to print the contents of the file stored in the field in the crystal report? (For eg the field contains the value "c:\project\test.txt" How to print the contents in the "detail" portion of the crystal report. When I select the field, the file name comes not the contents). Pl. help me.
Meenakshi.RMeenakshi,
I dont think there is a way to do exactly you want. But you can use heperlink option. Right Click on any field; Goto Format Field and Select HyperLink and File and Select the text file. When running the report, if you click that Field, then the text file will be opened.|||Madhi,
Each record has a different text file. With your suggestion, I have to make a permanent link to that text file. How to get different text file links? pl. guide.
Meenakshi.R|||Meenakshi,
If each record has to show different file, then you can use formula.
Do the same procedure that I told you except that instead of selecting the file, there is button labelled x-2 near text box. Click that and if the field it self represents the file name, then write this
{FieldName}|||Madhi,
I tried with your option. But when the report is run, the value stored in the field (ie) the file name comes without any hyperlink. No provision for clicking. Kindly guide me.

Meenakshi.R|||Which version of Crystal Report are you using?|||Sir,
The version of the crystal report is 8.0
Meenakshi.R|||Meenakshi,
I dont know where it goes wrong
Refer this (http://support.businessobjects.com/library/kbase/articles/c2006151.asp)|||Madhi,
Referred the article. Done as per the instructions. But still I am getting the field value only without the hyperlink. Any other solution?

Meenakshi.R|||I have a report where each record brings back a field with the path of a different image file. Each record in the details section prints out the word "Image" as a link, which I have set up as follows:

1. Created a formula which has nothing more in it than the word "Image". Placed into details section of report.
2. Click Format Field on this formula, go to Hyperlink tab. Choose 'A Website on the Internet', then open the formula box for Website Address.
3. In here, place the field from the database.

My images are available via a http server, but you may choose to use one of the other options there instead (eg 'A File' instead of 'A Website on the Internet'.|||Hai,
Created a formula. Placed in the detail section. Using format option, I have made a hyperlink by choosing the option Hyperlink from a file. With the formula button (hyperlink screen), I specified the field value. During run time, the formula name comes (but without hyperlink option). What to do?|||Should work, try debugging. I'd suggest copying the formula you are using to create the hyperlink into a regular formula and seeing what comes out, ie what it is trying to use to create this hyperlink. You might find that it has an invalid path, or is coming back blank, etc...|||Tried tried. I saved the report with field in the detail section by choosing "a file" from the hyperlink option, run the report, the field value stored in the field comes without hyperlink option. When viewing the report in design view, the hyperlink option shows 'a website on the internet'. I don't know why? pl. explain in detail.
Meenakshi.R|||My suggestion is that your file path is invalid. Test to see what CR thinks is in that field, for starters.

Ie, if you have a url stored in your database field and http:// already exists, you could end up with something like http://http://google.com

In my report, I can click on the field to open a file, provided that file path is correct. I typed C:\temp\test.txt into the File Name box. However, changing it to C:\temp\test1.txt simply does nothing as this file does not exist.

Also note that the field may be a hyperlink but will appear to be just a regular field until you mouse over. (ie, if you want it to appear as a hyperlink should then you will have to underline and colour it yourself).|||Sir,
I have created a fresh report and do all the things. When I click the preview button in Crystal report screen, I am able to click the hyperlink, and the corresponding file stored in the field gets opened. When this report is accessed via a VB program coding, simply the file name is displayed and I could not click the hyperlink. Pl. help me.

Meenakshi.R