I was wondering if there is a way to display a particular image into a table
record based on a condition. For example, I have a list of questions that
come in 3 different types, each type has a different image associated with
it, so it would look like this:
<Image1.bmp> First Question (type is 1)
<Image3.bmp> Second Question (type is 3)
<Image3.bmp> Third Question (type is 3)
<Image2.bmp> Forth Question (type is 2)
<Image1.bmp> Fifth Question (type is 1)
...and so forth.
So basically what I am wanting to do is (at the record level) display the
different images based on what type of question I want. But, I can't seem
to figure out how to insert three different images into one cell and supress
two of them based on the 'question_type'. Which was how I accomplished it
in crystal reports.
I think I could probably do this by storing the images in a column in the
database, then call that with my stored procedure. Although, I am afraid
that this would take up tons of space in the database and take forever for
the report to run.
Any thoughts? Thanks!
LisaThe sample report at the end of this posting shows how to conditionally
display an image.
This report conditionally displays an image based on a detail row value. In
this case Germany = Green, Purple = USA, and Canada = Red. The technique is
to place a rectangle in the table detail row and place all images at the
same location in the rectangle. The images should be the same size. Next is
to use an expression to set the image visibility:
=iif(Fields!<FieldName>.Value = "SomeValue", false, true). False = Not
hidden and True = Hidden.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lisa" <Lisa.Lambert@._nospam_etalk.com> wrote in message
news:O4L73T9eEHA.3916@.TK2MSFTNGP11.phx.gbl...
> I was wondering if there is a way to display a particular image into a
table
> record based on a condition. For example, I have a list of questions that
> come in 3 different types, each type has a different image associated with
> it, so it would look like this:
> <Image1.bmp> First Question (type is 1)
> <Image3.bmp> Second Question (type is 3)
> <Image3.bmp> Third Question (type is 3)
> <Image2.bmp> Forth Question (type is 2)
> <Image1.bmp> Fifth Question (type is 1)
> ...and so forth.
> So basically what I am wanting to do is (at the record level) display the
> different images based on what type of question I want. But, I can't seem
> to figure out how to insert three different images into one cell and
supress
> two of them based on the 'question_type'. Which was how I accomplished it
> in crystal reports.
> I think I could probably do this by storing the images in a column in the
> database, then call that with my stored procedure. Although, I am afraid
> that this would take up tons of space in the database and take forever for
> the report to run.
> Any thoughts? Thanks!
> Lisa
>
>
ConditionallyDisplayAnImage.RDL
----
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
tion"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Body>
<ReportItems>
<Textbox Name="textbox3">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<rd:DefaultName>textbox3</rd:DefaultName>
<Height>0.625in</Height>
<Width>6.375in</Width>
<CanGrow>true</CanGrow>
<Value>This report conditionally displays an image based on a detail
row value. In this case Germany = Green, USA = Purple, and Canada = Red. The
technique is to all images in a rectangle at the using the same origin and
size. Next is to place the rectangle in the table detail row cell. Finally,
is to set each images initial visibility using an expression:
=iif(Fields!<FieldName>.Value = "SomeValue", false, true).</Value>
</Textbox>
<Table Name="table1">
<Height>0.75in</Height>
<Style />
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>5</ZIndex>
<rd:DefaultName>textbox1</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>country</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>4</ZIndex>
<rd:DefaultName>textbox2</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Details>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="country">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<rd:DefaultName>country</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!country.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Rectangle Name="rectangle1">
<ReportItems>
<Image Name="image1">
<ZIndex>2</ZIndex>
<Height>0.15625in</Height>
<Visibility>
<Hidden>=iif(Fields!country.Value = "Germany",
false, true)</Hidden>
</Visibility>
<Source>Embedded</Source>
<Style />
<Value>greenbullet</Value>
<Sizing>AutoSize</Sizing>
</Image>
<Image Name="image2">
<ZIndex>1</ZIndex>
<Height>0.15625in</Height>
<Visibility>
<Hidden>=iif(Fields!country.Value = "USA",
false, true)</Hidden>
</Visibility>
<Source>Embedded</Source>
<Style />
<Value>greybullet</Value>
<Sizing>AutoSize</Sizing>
</Image>
<Image Name="image3">
<Height>0.15625in</Height>
<Visibility>
<Hidden>=iif(Fields!country.Value = "Canada",
false, true)</Hidden>
</Visibility>
<Source>Embedded</Source>
<Style />
<Value>redbullet</Value>
<Sizing>AutoSize</Sizing>
</Image>
</ReportItems>
<Style />
</Rectangle>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Details>
<DataSetName>DataSet1</DataSetName>
<Top>0.75in</Top>
<Width>2.375in</Width>
<Footer>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox7">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>3</ZIndex>
<rd:DefaultName>textbox7</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox8">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>2</ZIndex>
<rd:DefaultName>textbox8</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Footer>
<TableColumns>
<TableColumn>
<Width>2.16667in</Width>
</TableColumn>
<TableColumn>
<Width>0.20833in</Width>
</TableColumn>
</TableColumns>
</Table>
</ReportItems>
<Style />
<Height>1.625in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>69fa60f9-f434-44ed-a70d-2fc41b5d0cb3</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=localhost;initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>6.50001in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="country">
<DataField>Country</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT Country
FROM Customers
WHERE (Country = N'Germany') OR
(Country = N'USA') OR
(Country = N'Canada')</CommandText>
</Query>
</DataSet>
</DataSets>
<EmbeddedImages>
<EmbeddedImage Name="greenbullet">
<MIMEType>image/png</MIMEType>
<ImageData>iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAMAAADTRh9nAAAAAXNSR0IArs4c6QAAA
ARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRP
AAAAwBQTFRFISoIKDMKLjoLLzUbMT0MMzscNUMNO0o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ziEhAREeTnZmZtRPiou52XhZOTmVEIpA7mTSCjXUdTC6wMWRDK
B1MA/Td3eObvA7wAAAAASUVORK5CYII=</ImageData>
</EmbeddedImage>
</EmbeddedImages>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>e66e2b26-0660-4802-920d-211083d62c86</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>
No comments:
Post a Comment