Working days in a bpm

Searching other posts for “Add-Interval” show the usage to be:

Add-Interval( Today, -7, ‘days’)

So I think you want:

BpmFunc.WeekDay(ttPORelRow.Date01)== 0 ? BpmFunc.Add-Interval(ttPORelRow.Date01,-2 , 'days') 
      : (BpmFunc.WeekDay(ttPORelRow.Date01)== 1  ? BpmFunc.AddInterval(ttPORelRow.Date01, -3 , 'days') 
        : BpmFunc.AddInterval(ttPORelRow.Date01,-1 , 'days'))

If you expand the ttPORel table in the temp-tables pane, and double click the Date01, does it insert ttPORelRow.Date01 or ttPORel.Date01?

You have AddInterval() and Add-Interval(). Should only be one or the other.

When i double click date01 in the temp-tables pane it gives me … ttPORel.Date01
When i double click Add-Interval it gives me… Add-interval( , 10, ‘days’)

I therefore tried changing your syntax to just ttPORel.Date01 and everything with Add-Interval but it still returned an error.

So, i decided to go with your plan and start to gradually build it up…but no joy

When i break it down even further…

It may help a little if we tweak how we go about this…

I think this PartPlant.ReceiveTime can hold the 1 day…therefore we’d now have a field to point at.

Also noticed that there is a receive time sat behind part class setup.

I am going to open an entirely different post on this subject as i think the end user will be just happy to have the number of days in the system.

FWIW - I think this error

image

Is because WeekDay() returns an integer, and the DD is setting a field of type Date.

A few last really dumb questions …

  1. The E9 DD expression editor has the (x ? y : z) operator (if x is true then y else z)
  2. E9 uses double equals for comparisons ‘==’ vs ‘=’ (double clicking the box I highlighted above, will show which it expects)

Also, I’d have tried the following expressions (in order), to see where the syntax fails

  1. ttPORel.Date02 - If this fails then its saying that it doesn’t know what ttPORel.Date02 is. It should be compatible with the field PORel.Date02.
  2. ttPORel.Date01 - If this fails then its saying that it doesn’t know what ttPORel.Date01 is, or that it is incompatible with the field PORel.Date02.
  3. ((2 == 2) ? ttPORel.Date01 : ttPORel.Date02) - I added extra parenthesis, as they never hurt (unless put in the wrong spots). If this fails, then it doesn’t understand the conditional statement (x ? y : z).
  4. ((WeekDay(ttPORel.Date01) == 0) ? ttPORel.Date01 : ttPORel.Date02) - If this fails, it would be that the WeekDay function isn’t working, or that ttPORel.Date01 isn’t really of type Date. Check under the conversion functions to see if there is anything to force ttPORel.Date01 to a type that WeekDay() accepts.

Beyond that, I’d say to reach out to someone with more knowledge of the syntax used for E9 DD and BPM expressions.