Platform

Platform

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

 View Only
  • 1.  IF Statement in HTML/CSS

    Posted Thu February 21, 2019 09:08 AM

    I'm working on a report and Apptio and would really appreciate some help with my code.  Can you tell me how to adjust the code below so that if the "Projects Master Data.Baseline Date" is more than 3 years old, it will return blank (instead of the date).  Thank you in advance.

     

    <div
    class="appsText"
    align="left"
    style="padding:0px 0px 0px 0px;
    font-size:18px;color:#004C76;">
    <b><%=DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”)%></b>
    </br>


    #Platform


  • 2.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 09:28 AM

    Hi @Doug Copeland,

    Try this:

    <div
    class="appsText"
    align="left"
    style="padding:0px 0px 0px 0px;
    font-size:18px;color:#004C76;">
    <b><%=If(Months(CurrentDate("MM/dd/yyyy"))-Months(DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))>36,"",DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))<%></b>
    </br>

     

    I'm assuming by the phrase 'is more than three years old' I'm assuming  Baseline Date field is more than three years old when compared to todays date. I haven't tested the code, but another assumption I have made is that Apptio will work with functions embedded into other functions e.g. Months(DateFormat(xxxx,"####")) etc.

     

    Regards,

    Chris


    #Platform


  • 3.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 09:46 AM

    Chris,

     

    Thanks for taking time to reply.  The code looks like it should work, but I get the following error.

     

     

    @Christopher Wilson


    #Platform


  • 4.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 09:52 AM

    Hi Doug,

    Apologies, typo when copying the code... try this :

    <div
    class="appsText"
    align="left"
    style="padding:0px 0px 0px 0px;
    font-size:18px;color:#004C76;">
    <b><%=If(Months(CurrentDate("MM/dd/yyyy"))-Months(DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))>36,"",DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))%></b>
    </br>

     

    NOTE remove the '<' from the original code below

    <div
    class="appsText"
    align="left"
    style="padding:0px 0px 0px 0px;
    font-size:18px;color:#004C76;">
    <b><%=If(Months(CurrentDate("MM/dd/yyyy"))-Months(DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))>36,"",DateFormat(Projects Master Data.Baseline Date,”MM/dd/yyyy”))<%></b>
    </br>


    #Platform


  • 5.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 10:01 AM

    Chris,

    Seemed to work when I initially executed the code, but then game me the error below.  Maybe a limitation within Apptio?

     

     

    @Christopher Wilson


    #Platform


  • 6.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 11:25 AM

    Hi Doug,

    I've been testing the if statement in Apptio, and it fails badly if the data in your Master Data.Baseline Date is not recognized as a date. can you provide some example Baseline Date data? For example if your Baseline Date data is in following format yyyyMMdd (ISO format) e.g 20090101 doesn't seem to work, but if its 01/01/2009 it does work.

    Thanks,

    Chris


    #Platform


  • 7.  Re: IF Statement in HTML/CSS

    Posted Thu February 21, 2019 10:31 AM

    Hi

    You could use the Value() to assess the Boolean value in the IF statement : If(Value(calcul)>36,"","")

     

    Rachid


    #Platform