Avatar of orther
orther

asked on 

SQL Reporting Services and alternating images

I have a SQL report where I have placed a embedded image.  This is a small banner ad that will print at the bottom of our quote.  I have 3 separate images that I would like to have alternate on the report every hour.  Ex. If a quote is generated at 8:00AM the quote will display Banner1.png. When a quote is created at 9:15AM it will display Banner2.png and finally when a quote is created at 10:35AM it will display Banner3.png.  At 11:00AM quotes will again print Banner1.png.  All of the banner ads are exactly the same size.
SSRS

Avatar of undefined
Last Comment
orther
Avatar of orther
orther

ASKER

I have all 3 images imported into the report.
Avatar of Alpesh Patel
Alpesh Patel
Flag of India image

Please check the Value in expression with DateTime field. =IF(Time="8:00 AM", Field!Image1.Value, IF(Time="9:15 AM", Field!Image2.Value, Field!Image3.Value))
Avatar of orther
orther

ASKER

I am trying different variations but can't seem to get it.

=IIF(TimeOfDay>="8:00 AM" and TimeOfDay<= "8:59 AM", Fields!banner1.PNG.Value),
    IIF(TimeOfDay>="9:00 AM" and TimeOfDay<= "9:59 AM", Fields!banner2.PNG
    , Fields!banner3.PNG.Value))
Us an expression for the visibility of the banners. For your firs banner use:
=(hour(now) mod 3)<>0
for the second
=(hour(now) mod 3)<>1
for the third:
=(hour(now) mod 3)<>2
Place the three banners on top of each other.
Avatar of orther
orther

ASKER

so if I wanted to rotate between the three every hour how would I set this?
ASKER CERTIFIED SOLUTION
Avatar of Nico Bontenbal
Nico Bontenbal
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of orther
orther

ASKER

I cannot get that banner.rdl to work, but do I add this expression to each of the banner ads
Avatar of orther
orther

ASKER

oh wait not visibility but Under General for all 3.
<<I cannot get that banner.rdl to work>>
Strange. What error messages are you getting?

Sorry for the confusion. Forget about visibility. You need 3 embedded images in your report (which you probably already have). You need only one image control with this expression for the Value property:
=choose((hour(now()) mod 3)+1,"Banner1","Banner2","Banner3")
(replace the BannerX names with the names of your images). See screenshot below:

   User generated image
Avatar of orther
orther

ASKER

yea, my bad, I left the visibility code in there and so of course it wasn't working.  It looks like that did the trick.  Thanks much.
SSRS
SSRS

SQL Server Reporting Services (SSRS) is a server-based report generation software system from Microsoft. It can prepare and deliver a variety of interactive and printed reports and is administered via a web interface or its web service. Its web services interface also supports the development of custom reporting applications. Finally, SSRS can also be integrated with SharePoint. SSRS competes with other business intelligence tools, most prominently Crystal Reports.

10K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo