SSRS - How to show external image based on URL inside column - sql

I am trying to show images for products inside a basic report. The image needs to be dynamic, meaning the image should change based on the SKU value.
Right now I am inserting an image into a table, setting to external, and i've tried:
=Fields!URL.Value
=http://externalwebservername/sku= & Fields!SKU.Value
="http://externalwebservername/sku=" & Fields!SKU.Value
I do not get any images in my table.
My stored proc has all the data, including a URL with the image I wan't to show. Here is a sample of what the URL looks like:
http://externalwebservername/sku=123456
If I enter the URL in the field without "=" it will show that ONE image only.
How should I set up the expression to properly show the external image based on a dynamic URL? Running SQL 2016

Alan's answer should work, but in our environment we have strict proxy/firewall rules, so the two servers could not contact each other.
Instead we are navigating to the file stored on our storage system.
We altered the URL column to point to file path in the stored procedure. Insert image, set Source to External and Value set to [URL].
URL= file://server\imagepath.jpg

As long as the account executing the report has permissions to access the URLs then your 3rd expression should have worked.
I put together a simple example as follows.
I created a new blank report then added a Data Source. It doesn't matter where this points, we won't use it directly.
Then I created a dataset (Dataset1) with the following SQL to give me list of image names.
SELECT '350x120' AS suffix
UNION SELECT '200x100'
UNION SELECT '500x500'
Actually, these are just parameters for the website http://placehold.it/ which will generate images based on the size you request, but that's not relevant for this exercise.
We'll be showing three images from the following URLs
http://placehold.it/350x120
http://placehold.it/200x100
http://placehold.it/500x500
Next, create a table, I used 3 columns to give me more testing options. Set the DataSetName to DataSet1 if it isn't already.
In the first column the expression is just =Fields!suffix.Value
In the second column I added an image, set it's source property to External and the Value to ="http://placehold.it/" & Fields!suffix.Value
I then added a 3rd column with the same expression as the image Value so I could see what was being used as the image URL. I also added an action that goes to the same URL, just to check the URL did not have any unprintable characters in it that might cause a problem.
The basic report design looks like this.
The rendered result looks like this.

Related

#Dblookup and formatting on web

I have been developing a web application using domino, therein I have dblookup-ing the field from notes client; Now, this is working fine but the format of value is missing while using on web.
For example in lotus notes client the field value format is as above
I am one, I am two, I am one , I am two, labbblallalalalalalalalalalalalalalalalalalaallllal
Labbbaalalalallalalalalalaalallaal
Hello there, labblalalallalalalllaalalalalalalalalalalalalalalalalalalalalalalala
Now when I retrieve the value of the field on web it seems it takes 2 immediate after 1. and so forth, I was expecting line feed here which is not happening.
The field above is multi valued field. Also on web I have used computed text which does db lookup from notes client.
Please help me what else could/alternate solution for this case.
Thanks
HD
Your multi-valued field has display options associated with it and the Notes client honors those. Obviously, your options are set up to display entries separated by newlines.
The computed text that you are using for the web does not have options like that and the field options are irrelevant because you aren't displaying the field. Your code has to insert the #Newlines. That's pretty easy because #DbLookup returns a list, and if you concatenate a list and a scalar, the scalar will be appended to each element of the list. (Look at the third example under "concatenation, pairwise" here to see what I mean.
The way you've worded your question is a little unclear to me, but what you need in your computed text formula is either something like this:
list := #DbLookup(etc,. etc.);
list + #Newline;
Or something like this:
multiValueFieldContainingListWithDbLookupResult + #NewLine;
I used #implode(Dblookupreturnedvalue;"");
thanks All :)

Pentaho: Image in Pentaho form

I want to fetch image from local path (i.e: C:/Users/myname/sample.jpg).
Already tried with image icon on left of the form and set the value from the above both but the thing is i need to set the image from external . Like property file or kettle file.
please help me on this.im using Pentaho Designer 5.3.0
thanks in advance
If you want to get the location of the image from a property file, you have to think about how to get that value and take it to the report, that you can do with a kettle transformation, that takes the value you want from the properties file and send it to a Report, in the pdi there is a step called Pentaho Reporting Ouput, which makes a call to the report, to this you will pass as parameter the location of the image that you want to be displayed (the name of the parameter in the pdi and in the Report designes must be the same), you can do the following:
Create a parameter, which will be of type string, this will be the parameter will receive the location of the image on the disk
Add an image field instead of an image, and pass the parameter you created as a value
After you can upload the image you want, just pass the physical address to the report from the pdi.
I hope I help you

Remove sub-string from data in sql table column

I have a table that has a bunch of url's within a certain column. We no longer want a certain url within the table and instead of manually updating each data record I was curious if there is a way to remove just a certain type of url through an update query?
For instance, a data record with the following url's exists:
Presentation (PowerPoint File)<br> Presentation (Webcast)
and I want to remove the smil url so the data only shows:
Presentation (PowerPoint File)<br>
I want to remove the entire "smil" url from this string (from ), and every other smil url from the other records (the other records are similar with a different smil file name). Some of the records could have more than two urls, BUT the "smil" url is always the last one.
Preserving some of the comment history so future readers understand the decision points before implementing the solution
Does it always follow the pattern of text<br>text
there are a few times where there are two urls and they exclude the <br> and then there are a few times where it is just the smil url within the data.
You haven't clearly define what a "smil" url is. Is it one with smil in it anywhere? With the file suffix being .smil? With /smil/ in the path? some combination of these?
The problem you're going to have is that to properly solve this, you'll need to be able to have some insight into the html fragments. That's usually a .NET thing, the string matching in TSQL is likely to be insufficient for your needs. You could try taking multiple passes as it. If it follows the text<br>text pattern, you could left(myCol, charindex(mycol, '<br>')) where Mycol like '%smil%' and keep taking passes at it until you've found all the patterns.
#billinkc: I see where you are going, I was thinking if it would be possible to remove everything from the start of <a href="xxx since those "smil" links all start with that character string.
And there'd never be the case of streaming<br>foo? If so, then yeah, search for the <a href="http: using charindex/patindex (can never remember which) and then slice it out with left/substring.
#billinkc: yup that will always be the case. the "streaming" url is ALWAYS last. Ok this was easier than I thought, just needed some outside eyes. Thank you.
Given that we know we don't have to worry about anything useful existing after the smil url and that the url will always be an external, we can safely use a left/substring approach like
DECLARE #Source table
(
SourceUrl varchar(200)
)
INSERT INTO #Source
(SourceUrl)
VALUES
('Presentation (PowerPoint File)<br> Presentation (Webcast)');
-- INSPECT THIS, IF APPROPRIATE THEN
SELECT
S.SourceUrl AS Before
, CHARINDEX('<a href="http://', S.SourceUrl) AS WhereFound
, LEFT(S.SourceUrl, CHARINDEX('<a href="http://', S.SourceUrl) -1) AS After
FROM
#Source AS S
WHERE
S.SourceUrl LIKE '%smil%';
-- Only run this if you like the results of the above
UPDATE
S
SET
SourceUrl = LEFT(S.SourceUrl, CHARINDEX('<a href="http://', S.SourceUrl) -1)
FROM
#Source AS S
WHERE
S.SourceUrl LIKE '%smil%';

Domain Names to Webpage Titles in OpenRefine

I have a column in Excel of domain names (like stackoverflow.com) and would like to create a corresponding column with the title of the domains (like "Stack Overflow").
I uploaded the Excel file into OpenRefine. I believe the best way to do this would be to call the "Add column by fetching URLs on column" function. But I don't know what expression to use.
The way I do it is as follows:
(1) Have visitable URLs in the source column. I.e., http://stackoverflow.com instead of just the domain name.
(2) Apply "Add column by fetching URLs..." as you said. (If you're hitting pages on the same domain over and over, make sure you set a reasonable delay.)
(3) Using this first new column, create a second new column based on newCol1 by parsing the HTML that's returned:
value.parseHtml().select("title")[0].toString()
Notes:
(a) You need the toString() else you'll see blank values in the new column after you apply the function.
(b) You don't have to create a second new column; you could just apply a transform using the same formula as above.
(c) I've also tried using a split:
value.split("")[1].split("")[0]
I don't have my results handy at the moment, but I believe that also worked.

Birt dynamic image uri

I have the URI to an image stored in a database. I created a dataset, which contains the image location. When choosing the location of the image I used a script which says this.uri = row[location],
however the image is not rendering and I am getting an error which says the rsource could not be reached. Is what I am trying to do possible in Birt, or is there any way to dynamically set the uri?
Thanks in Advance
You should not have to use a script to do this.
I assume this image is embedded within a table bound to the dataset. If it is not, you just have to select the dataset in the "bindings" tab of the image. When the image is correctly bound we have to:
Select the image -> properties -> reference -> edit
Set the option "select from URI", and for "Enter URI" expression don't forget to switch from "constant" to "javascript syntax".
With the expression builder select your dataset column within "Available column bindings" and here we go!
If you still have an issue check the URI generated with your web browser console.