Skip to main content
1-Visitor
April 12, 2013
Solved

Report Computed Fields: Challenge #1

  • April 12, 2013
  • 1 reply
  • 1307 views

The following report field computation flags an item with a 1 if its State on a specific date/time was 10 (i.e. Closed):

HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 14 ? 1 : 0.

However, I’d like to flag with a 1 if the historical State was 10 (Closed) or 41 (Canceled). I've made several attempts to no avail. Can you assist please?

    Best answer by matt_giltaji

    Hi Anita,

    I don't have much experience with the HistoricFieldValue() itself, but I do enjoy computed fields .

    From how I see it, there are 2 ways to get the functionality you mentioned..

    The more straightforward way is to use parentheses to group the OR:

    ((HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 10) or (HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 41)) ? 1: 0

    An alternate way is to use nested ? operators:

    (HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 10) ? 1 : ((HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 41) ? 1 : 0 )

    Hope that helps,

    Matt

    1 reply

    1-Visitor
    April 12, 2013

    Hi Anita,

    I don't have much experience with the HistoricFieldValue() itself, but I do enjoy computed fields .

    From how I see it, there are 2 ways to get the functionality you mentioned..

    The more straightforward way is to use parentheses to group the OR:

    ((HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 10) or (HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 41)) ? 1: 0

    An alternate way is to use nested ? operators:

    (HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 10) ? 1 : ((HistoricFieldValue(State,timestamp("Apr 1, 2013 11:59:59 PM")) == 41) ? 1 : 0 )

    Hope that helps,

    Matt

    AnitaD1-VisitorAuthor
    1-Visitor
    April 15, 2013

    thanks, Matt. I really appreciate your help.