Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

How to display images in VA dasboard from database

Accepted Solution Solved
Reply
Contributor
Posts: 55
Accepted Solution

How to display images in VA dasboard from database

[ Edited ]

Hi All,

 

I am using VA 7.3, is there any way or work around to display the images in VA dashboard. Suppose I selected a employee ID or Name in VA dashboard and I do have his image stored in the database. Now I want to display his/her image in the image object or some other way.

 

Any help is really appreciated.

 

Thanks & Regards,

Abhishek Pathak 


Accepted Solutions
Solution
‎06-16-2016 08:13 AM
Contributor
Posts: 26

Re: How to display images in VA dasboard from database

[ Edited ]

how many images are we talking about? This number would help determine the approach.

 

These are the possible solutions. None of this code is tested. 

 

1. transfer images to local file system and display the image using the Image object in VA. This is only practical for a small number of images. 

 

 

2. transfer images to a WebDav server. Then add a stored process to VA with a parameter for the employee name. The stored process will write HTML code to reference the image on the webDav server. 

 

data _null_ ;
  file _webout;
  set pics;
 
  put '<HTML>';
   put '<HEAD></HEAD>';
   put '<BODY>';
  
  put "<h3>Employee &employee</h3>";
 
  put '</BODY>';
  put '</HTML>';
 
run;

 

3. If you want to read the images directly from the database, there your stored process will look something like this, 

 

Libname pics "<to source database>";

 

proc sql noprint;

  create table pics as

  select photo as img format=$32767. informat=$32767.

  from pics.picstable

  where employee="&employee";   /* macr o variable passed from stored process in VA */

quit;

 

/* transfer image from database to a temporary location that can be referenced by your SAS web server */

/* this will be something like - /opt/sas/config/Lev1/Web/WebServer/htdocs/pics */

 

data _null_;

  set pics;

  file "/temp/somewhere on your VA server.jpg" LRECL=32767 NOPRINT NOTAB; 

  put img;

run;

 

/* again use HTML to display the picture */

data _null_ ;
  file _webout;
  
  put '<HTML>';
  put '<HEAD></HEAD>';
  put '<BODY>';
 
  put "<h3>Employee &employee</h3>";
 
  put "<IMG src='http://localwebserver/pics/employee&..jpg'"></IMG>";
  put '</BODY>';
  put '</HTML>';
 
run;

 

 

 

RIchard

View solution in original post


All Replies
Contributor
Posts: 26

Re: How to display images in VA dasboard from database

Hi, 

 

can you elaborate on "database". Is it a Webdav store? If so then you can display the image using the url reference. 

 

Richard

Contributor
Posts: 55

Re: How to display images in VA dasboard from database

Hi Richard,

The databases will be like oracle and mssql..

Can you please help out by letting us to know how to display the images using URL( some sort of steps)

 

Thanks & Regards,

Abhishek Pathak 

Solution
‎06-16-2016 08:13 AM
Contributor
Posts: 26

Re: How to display images in VA dasboard from database

[ Edited ]

how many images are we talking about? This number would help determine the approach.

 

These are the possible solutions. None of this code is tested. 

 

1. transfer images to local file system and display the image using the Image object in VA. This is only practical for a small number of images. 

 

 

2. transfer images to a WebDav server. Then add a stored process to VA with a parameter for the employee name. The stored process will write HTML code to reference the image on the webDav server. 

 

data _null_ ;
  file _webout;
  set pics;
 
  put '<HTML>';
   put '<HEAD></HEAD>';
   put '<BODY>';
  
  put "<h3>Employee &employee</h3>";
 
  put '</BODY>';
  put '</HTML>';
 
run;

 

3. If you want to read the images directly from the database, there your stored process will look something like this, 

 

Libname pics "<to source database>";

 

proc sql noprint;

  create table pics as

  select photo as img format=$32767. informat=$32767.

  from pics.picstable

  where employee="&employee";   /* macr o variable passed from stored process in VA */

quit;

 

/* transfer image from database to a temporary location that can be referenced by your SAS web server */

/* this will be something like - /opt/sas/config/Lev1/Web/WebServer/htdocs/pics */

 

data _null_;

  set pics;

  file "/temp/somewhere on your VA server.jpg" LRECL=32767 NOPRINT NOTAB; 

  put img;

run;

 

/* again use HTML to display the picture */

data _null_ ;
  file _webout;
  
  put '<HTML>';
  put '<HEAD></HEAD>';
  put '<BODY>';
 
  put "<h3>Employee &employee</h3>";
 
  put "<IMG src='http://localwebserver/pics/employee&..jpg'"></IMG>";
  put '</BODY>';
  put '</HTML>';
 
run;

 

 

 

RIchard

Contributor
Posts: 55

Re: How to display images in VA dasboard from database

Thank you Richard for such a great solution.

The only doubt I am having...using the method propsed, if I am not wrong - I suppose the image will open in seperate browser...is there any way that we can display the image in the VA dashboard itself?

 

Thanks & Regards,

Abhishek Pathak

Contributor
Posts: 26

Re: How to display images in VA dasboard from database

yes this is unfortunately correct. And there is also no interactivity possible between a stored process object and another VA object. I think this is VERY easy for SAS to implement. I really hope this is in a next version, then we can make some really nice dashboards using the power of stored processes. 

 

I do not have the knowlegde, but it may be possible for a piece of javascript to 'scrape' the current value of a drop down list for example and then pass this into the stored process..... If you know how to do this I would be grateful to learn how. 

 

Richard

Contributor
Posts: 55

Re: How to display images in VA dasboard from database

Hi Richard,

 

I will try to do some R&D on it....if I get some solution definately I will share it.

For the time being may be somebody from community can help us on it..

 

Thanks & Regards,

Abhishek Pathak

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 684 views
  • 2 likes
  • 2 in conversation