Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Changing the Image based on the parameter

Author  Topic 

sgandhi
Posting Yak Master

115 Posts

Posted - 2009-08-19 : 10:19:04
Hi, i have a parameter called Company

Now what i want to do is each time the parameter value for the company changes, i want the logo to change.

EG: if they user selects company abcd from the paramter list, i want to display c:\abcd.jpg as the image, if they select defg as the company then image c:\defg.jpg should be displayed and so on.

How do i write this in the expression of the image control?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-19 : 10:40:16
=IIF(Parameters!Param1.Value = "1", "c:\abcd.jpg", "c:\defg.jpg")



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

sgandhi
Posting Yak Master

115 Posts

Posted - 2009-08-19 : 10:42:12
I get the following error.
[rsRuntimeErrorInExpression] The Value expression for the image ‘Image1’ contains an error: Overload resolution failed because no Public '=' can be called with these arguments:
'Public Shared Operator =(a As String, b As String) As Boolean':
Argument matching parameter 'a' cannot convert from 'Object()' to 'String'.
[rsInvalidEmbeddedImageProperty] The value of the ImageData property for the image ‘Image1’ is “”, which is not a valid ImageData.
Preview complete -- 0 errors, 2 warnings

What does this mean
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-19 : 11:23:05
The formula is for the Path to the file. Not the image data itself.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

sgandhi
Posting Yak Master

115 Posts

Posted - 2009-08-19 : 11:28:41
So how do i fix it. I have tried adding the images to the database too. I dont know which approach is easier, getting the images from the database or from the file system itself.

Can i modify the above expression to read from the database.
Im stuck and now confusing myself. Your help is very much appreciated
Go to Top of Page

sgandhi
Posting Yak Master

115 Posts

Posted - 2009-08-20 : 10:40:02
Please someone help me.

If i have confused you then let me try explaining again.

My report is executing using a OLAP cube. I have a parameter called COMPANYPROGRAM which the user selects from and the data for that company is displayed.

Now i have created a new table (which isnt part of the OLAP) which contains the company name and the image.

CREATE TABLE [dbo].[var_images](
[ImageId] [int] IDENTITY(1,1) NOT NULL,
[company_name] [nvarchar](128) NULL,
[ImageData] [varbinary](max) NULL,
[ImagePath] [nvarchar](200) NULL
) ON [PRIMARY]

If i add a separate datasource and create a table it displays all the images

What i want to do, is i want the image from the var_images table to only display the value for which ever company is picked from the parameter. Does this make sense. I need to somehow link these together.
Go to Top of Page
   

- Advertisement -