just david

I am using the Crystal Reports Developer XI Release 2.

I am passing a string parameter from my Visual Studio 2005 (Visual Basic) Windows Forms application to my Crystal Report. Let's call it "myimagepath" and it contains a value like "c:\pathtomyimage\myimage.jpg"

Now I have a picture object on my report. I want the graphic location formula to set the image path and display the image that I refer to in my parameter myimagepath. What will my graphic location formula for my picture image look like Or am I approaching this poorly

Thanks for your help.

David




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mewdied

Your graphic location formula should just contain the parameter field.



Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

CrystalKeehr

This is straight out of "The Complete Reference: Crystal Report XI" by George Peck, a book worth having around:
Insert a picture in your report. You have to start with some picture, it doesn't matter which one.
Right click on the picture and choose Format Graphic from the popup Format menu.
Click the picture tab in the Format Editor dialog.
Click the Graphic Location formula button at the bottom of that page.
Drag and drop your parameter into the formula section.
Save it.
Now when you pass your parameter, you should not enclose it in quotes: that will not compute. Just pass the path to the image and the image name, such as c:\pics\cat.bmp.
This is covered on pages 183-185 of Peck's book.
I hope this helps.




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

rdcole

I got a Crystal Report setup using the dynamic system of the graphic location formula, but when I run my process and output my report, after 2 or 3 times it crashes my entire application. I am using the basic set up of a placing the image name / path in a field in my db and passing that to crystal. It prints the desired image based on what I am trying to do but crashes. If I take that out and try to just type in the path name and only load the image name from the db..it it never crashes but it is no longer dynamic and wont change my image out.

Any one know what could be causing this issue Any help would be greatly appreciated.

Thanks,


Richard Cole




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

CrystalKeehr wrote:
This is straight out of "The Complete Reference: Crystal Report XI" by George Peck, a book worth having around:
Insert a picture in your report. You have to start with some picture, it doesn't matter which one.
Right click on the picture and choose Format Graphic from the popup Format menu.
Click the picture tab in the Format Editor dialog.
Click the Graphic Location formula button at the bottom of that page.
Drag and drop your parameter into the formula section.
Save it.
Now when you pass your parameter, you should not enclose it in quotes: that will not compute. Just pass the path to the image and the image name, such as c:\pics\cat.bmp.
This is covered on pages 183-185 of Peck's book.
I hope this helps.


Hi!
I'm using CR XI. I tried to use this method. It seems to work very well when I "run" my report directly into Crystal Reports and I manually change the @Logo parameter value (for example "c:\temp\myimage.bmp").
But when I try to pass the image path from my VB 2005 application, CR does not show any logo image.
I'm using the following code:

(...)
Dim rptFile As New ReportDocument
rptFile.Load(Application.StartupPath + "\myreport.rpt")
rptFile.RecordSelectionFormula = "{Company.ID}=" & myForm.lblCompany.Text
rptFile.DataDefinition.FormulaFields("Logo").Text = """" & My.Settings("imgLogo") + """"
(...)

Also rptFile.DataDefinition.FormulaFields("Logo").Text = My.Settings("imgLogo") does not work.
My.Settings("imgLogo") correctly stores the image path.

Could you kindly help me
Thanks in advance.




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

CrystalKeehr

I see that you've gone to great lengths to wrap your formula text in quotes. I would look at that first. I passed my image as a parameter and had to be careful about not enclosing in quotes because I found that Crystal would not process the quoted version. I suspect that Crystal is giving you the same pain with your formula text. That's just my best guess.



Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

Thank you for your quick answer.

I tried to use the following:
rptFile.DataDefinition.FormulaFields("Logo").Text = "d:\myimagefile.bmp"
It does not work too.

How to pass the image file path string




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

I have just tried to use a parameter.
If, in CR XI, I manually set my Logo parameter to "d:\logo.bmp" the logo image is correctly changed.
If I try to pass the image path from VB 2005 it does not work at all:

(...)
Dim rptFile As New ReportDocument
rptFile.Load(Application.StartupPath + "\myreport.rpt")
rptFile.SetParameterValue("Logo", "d:\logo.bmp")
rptFile.RecordSelectionFormula = "{Company.ID}=" & myForm.lblCompany.Text
(...)




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

CrystalKeehr

I'm using C# but I don't believe there is any difference in how the SetParameterValue( ) function gets set. Here is the command I used:

this.reportDocument1.SetParameterValue(0, "C:\\Documents and Settings\\JLK\\My Documents\\My Pictures\\cat1.bmp");

Note that I refer to my parameter by its index, which is zero. And I give the complete path to the bitmap I want to display.

It works like a charm, so I'm not sure what is happening in your situation.





Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

I think my problem is the following.
Let me explain it... I have two machines: the first runs Visual Studio 2005; the second one runs Crystal Reports XI.

I'm used to create reports with CR XI using the second machine but then I'm used to copy them to the first machine that I use for developing my VB 2005 application (here 10.2.3600.0 version of CR is used...).

So, I think that 10.2.3600.0 version is not able to support the "dynamic image" functionality offered by CR XI ( http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1062931&SiteID=1 ).

Now I have a PROBLEM...
I developed a quite complex VB 2005 application that is installed and used by many customers.
The problem that now I cannot easily upgrade my developing machine to CR XI because I think I should pass an update to 11.5.2700 CR XI's dlls to all my customers.

How could I solve this issue

I'm reading this page http://www.thedatafarm.com/blog/PermaLink.aspx guid=8e33df6c-13b7-4184-b448-2b5ad23a92fe but I cannot understard what the author means when he writes "Add this to the project and then add it to the report in design time. Then you can drag & drop the img field onto the report."

Could you kindly help me
Many thanks again!




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mewdied

Yes, you are right, the version of Crystal Reports that is installed with Visual Studio 2005 does not have this functionality, it was added in Crystal Reports XI. To be able to update your customers, you will need to rebuild your exe to use the 11.5.3700 dll's, and redeploy the Crystal Reports Runtime using the Crystal Reports XIr2 merge modules or server install available from: http://support.businessobjects.com/downloads/merge_modules.asp#06

Make sure that you use the one ending in 2005.





Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

Thank you for your answer!

My VB 2005 application has an "autoupdate" feature that I use to deploy updates to all my customers.
So, it would be easy to distribute the new .exe to use 11.5.3700 dll's. The problem is how to download and apply CR XI's dlls. I think my customers would not appreciate the idea to make a backup of the database, uninstall my application, download it again and reinstall it.
Is it not possible to use another solution at all




Re: Crystal Reports for Visual Studio Dynamic Image Location by using a parameter

mranzani

Hi!

I've tried to use these suggestion (see http://www.thedatafarm.com/blog/PermaLink.aspx guid=8e33df6c-13b7-4184-b448-2b5ad23a92fe ) with VB 2005 + CR 10.2.3600.0. Now I'm able to dinamically change the graphic header!! Big Smile
It perfectly works.

Now I have another problem. Sad
Some of my report's detail sections have very long "static" textboxes. After I dinamically add the graphic header, it happens that some of these textboxes automatically move to the next page. So I obtain an empty page that only has the image header at the top of it.
Any suggestion

Thanks in advance.