Display image instead of value from data source


  • Hi All,

    unfortunately I am new to SharePoint so please don't stone me for my un-knowledge.

    Here is a short explanation what I am trying to do:

    We use a tool for status tracking of our services, now we want to display the results to SharePoint. We gather our values using a simple SQL statement - SELECT TOP (50) [A] ,[B] ,[C] ,[D] ,[E] ,[F] ,[StatusCode] FROM [MyDatabase].[dbo].[MyTable] WITH (NOLOCK) where [A] = 'MyValue'

    Everything works fine, except there are some problems sitting in front of the screen who are unaware what the status codes mean. Therefore I would like to display the status as an image - e.g StatusCode 1=1.jpg, StatusCode 2=3.jpg and so on.

    Unfortunately I bricked my table which was automatically generated through "Insert => Data View => MyDatabaseConnection" when I tried to do this.

    Yes I know, use Google & Co... I tried but it didn't work out. Could you please recommend me a way how to manage to display a picture instead of a simple value?


    Text (OK an N/A) would be also enough - unfortunately this does not work <xsl:value-of select="if (@StatusCode  &gt 0) then 'OK' else 'N/A'"/>

    BR & Thx

    • Edited by JohnnyElvis Wednesday, January 18, 2017 4:08 PM
    Wednesday, January 18, 2017 1:27 PM

All replies

  • You can use JavaScript to achieve this goal.

    Wednesday, February 01, 2017 2:34 AM
  • Hi,

    I understand you use SharePoint 2013 for displaying the status tracking. Please elaborate

    1. If the tool is developed using SharePoint Lists/Libraries / customization
    2. Or the data is stored in SP lists/libraries and the status tracking is customized
    3. Whether the data is stored in SQL DB and just a report is shown in SharePoint page

    If you are directly querying the SharePoint Content DB, then it is not advisable. SharePoint data needs to be queried using CAML Query, REST API, there are lot of ways you can query the SP data.

    Read the below articles regarding querying the SharePoint data using CAML Query.

    CAML Query tutorial for SharePoint

    CAML Query to Get Data from SharePoint List

    Using CAML Query Builder for SharePoint

    Hence, please elaborate your requirement (from where you want to display the status picture) so that we can give try to provide the best solution to implement. 

    Please click the 'Mark as Answer' if this post solves your problem or "Vote As Helpful" if it was useful! :)
    Explore the SharePoint

    Wednesday, February 01, 2017 4:22 AM