Platform

Platform

A place for Apptio product users to learn, connect, share and grow together.

 View Only
  • 1.  HTML code to format results as stoplight

    Posted Wed January 09, 2019 08:27 AM

    I have some basis HTML code written in one of my custom reports.  The area I am having trouble with is the current HTML returns the actual work "Green" if the Project Health is Green, "Yellow" if the Project Health is Yellow and "Red" if the Project Health is Red.  The result I would like to get is the HTML for fill with the color returned and not have any text (i.e. Green, Red & Yellow).  Any help is greatly appreciated.  I have pasted the current HTML below and included a pictorial of what I am trying to achieve.  Thanks in advance, Doug

     

    HTML:

    <div
    class="appsText"
    align="center"
    style="padding:0px 0px 0px 0px;
    border-style: solid;
    font-size:18px;color:#004C76;">
    <b><%=Projects Master Data.Project Health%></b>
    </br>

     


    #Platform


  • 2.  Re: HTML code to format results as stoplight

    Posted Wed January 09, 2019 09:50 AM

    Hi there @Doug Copeland,

     

    I'm no expert in HTML, but based on the details provided, it looks like your code is attempting to assign a color to the text itself.

    Perhaps the code you're looking for is something that highlights/colors the space around the actual text.

    If this is correct, maybe you can give this html code a whirl:

     

    <div
    class="appsText"
    align="center"
    style="padding:0px 0px 0px 0px;
    border-style: solid;
    font-size:18px;color:#008000;">
    <b>

    <span style="background-color: #008000">

    <%=Projects Master Data.Project Health%>

    </span>

    </b>
    </br>

     

    I hope this helps or gives you some ideas.

    Good luck!


    #Platform


  • 3.  Re: HTML code to format results as stoplight

    Posted Wed January 09, 2019 10:10 AM

    Hi @Kyle Castro,

     

    Thanks for taking time to reply.  One thing I probably wasn't clear on is this screenshot if one part of a larder report.  The report allows you to select different Projects and depending on the Project selected it will return the Project Health (Projects Master Data.Project Health). 

     

    That being said, I can't hardcode the color.  I would need it to change based on the Project Health for the selected Project which may be Red, Green, Yellow or Blank.


    #Platform


  • 4.  Re: HTML code to format results as stoplight
    Best Answer

    Posted Wed January 09, 2019 10:42 AM

    Hi Doug,

    I'm no expert either, but

    Try this:

    <div
    class="appsText"
    align="center"
    style="padding:0px 0px 0px 0px;
    border-style: solid;
    font-size:18px;
    background-color:<%=Projects Master Data.Project Health%>;">
    <b>
    Project Health
    </b>
    </br>
    </div>

     

    This should give you the desired effect, make sure your value Projects Master Data.Project Health returns a valid css colour e.g. 'green' or hex colour code (including a #prefix) e.g. '#008000'. Note also the closing div tag.


    #Platform


  • 5.  Re: HTML code to format results as stoplight

    Posted Wed January 09, 2019 10:31 AM

    Hi @Doug Copeland, hi @Kyle Castro,
    we used some formatting in a table via the "highlight" functionality (can be found in the ribbon within the table section). 

     

    =IF({blabla Master Data.columnxy}="G","green",if({blabla Master Data.columnnxy}="A","yellow",if({blabla Master Data.columnxy}="R","red","grey")))

    This was the result:

     

    Perhaps you can use also a table to show your project results.

     

    Best regards, Fabian


    #Platform


  • 6.  Re: HTML code to format results as stoplight

    Posted Wed January 09, 2019 11:12 AM

    @Christopher Wilson

     

    That worked perfect.  Thanks to all who took time to respond.

     

    Doug


    #Platform


  • 7.  Re: HTML code to format results as stoplight

    Posted Wed January 09, 2019 12:54 PM

    Hi, glad you got it working @Doug Copeland

    Just in case, here is one more option you can try... using an html table and nested "if" statement, kind of similar to @Fabian Woldsen's suggestion:

     

     

    <div
    class="appsText"
    align="center"
    style="padding:0px 0px 0px 0px;
    border-style: solid;
    font-size:18px;color:#004C76;">

    <br>
    <table width="XX" height="XX" cellspacing="XX">

    <tr>
    <td  align="center" bgcolor=<%=if(<%=Projects Master Data.Project Health%>="XXXX","#01DF01",if(<%=Projects Master Data.Project Health%>="YYYY","#DF0101","#FFFF00"))%>>

    </td>
    </tr>
    </table>
    </br>

    </div>


    #Platform


  • 8.  Re: HTML code to format results as stoplight

    Posted Thu January 10, 2019 10:08 AM

    @Doug Copeland , I know this was addressed however here is a link to how this can be done with a function as well.  

     

    https://tbmcouncil.jiveon.com/message/3315

     

    https://tbmcouncil.jiveon.com/docs/DOC-4913


    #Platform