Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to calculate days between 2 dates with an advanced rule (error)

SOLVED
Go to solution
Highlighted
mvillalobos
Regular Collector

Trying to calculate days between 2 dates with an advanced rule (error)

Hello

 

I am trying to calculate the days between 2 dates into an advanced rule in PPM but it fails always.

 

I do it with a normal SQL statement and it works propertly.

 

the statement for the SQL:    (tora.jpg)

SELECT TO_DATE(PARAMETER19) - TO_DATE(PARAMETER18),  TO_DATE(PARAMETER19) - TO_DATE(PARAMETER18) FROM PPMUSER.KCRT_REQ_HEADER_DETAILS WHERE REQUEST_ID = 31236;

 

The Rule is on -> Rule.jpg

 The error is on -> error.jpg

 The sql statement succesfull -> Tora.jpg

 The content of parameters -> Parameters.jpg

 

Thank you very much

 

 

 

 

 

 

3 REPLIES
Radim79
Super Collector

Re: Trying to calculate days between 2 dates with an advanced rule (error)

Hi Marcus,

try remove the semicolon mark from the end of the sql statement in the rule.

 

Regards

 

Radim

Re: Trying to calculate days between 2 dates with an advanced rule (error)

Here is an example of what we are doing (slightly different, since we are calculating days, hours, minutes)

mvillalobos
Regular Collector
Solution

Re: Trying to calculate days between 2 dates with an advanced rule (error)

Hello

 

Thank you very much. 

 

the statement that works in this case is:

"SELECT
TO_DATE(PARAMETER19, 'YYYY-MM-DD HH24:MI:SS') - TO_DATE(PARAMETER18, 'YYYY-MM-DD HH24:MI:SS'), TO_DATE(PARAMETER19, 'YYYY-MM-DD HH24:MI:SS') - TO_DATE(PARAMETER18, 'YYYY-MM-DD HH24:MI:SS') FROM PPMUSER.KCRT_REQ_HEADER_DETAILS
WHERE REQUEST_ID = 31236"

//Add this to "OnDomLoad" event