cancel
Showing results for
Search instead for
Did you mean:
cancel
Showing results for
Search instead for
Did you mean:

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

4-Participant

## Report Computed Fields: Challenge #1

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?

1 ACCEPTED SOLUTION

Accepted Solutions
1-Newbie
(To:AnitaD)

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

2 REPLIES 2
1-Newbie
(To:AnitaD)

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

4-Participant
(To:matt_giltaji)

thanks, Matt. I really appreciate your help.

Announcements