Question

comparing two dates

I'm creating a business process, and I want to compare two date fields, the result of this difference should provide me with the number of days that a particular item lasts in other integer field. Problem with formula or it should be faster with sql ?

 

RoundOff(([#data zakonczenia.First item of resulting collection.Data planowanego zamknięcie#]-[#data rozpoczecia.First item of resulting collection.Data rozpoczęcia#]).TotalDays)



error: 

Formula value error: Cannot convert type "Double" to "Boolean"

Like 1

Like

5 comments

Two thoughts, where do you get the RoundOff() function from, it doesn't look like a C# function (should it not be Math.Round()).

 

It may or may not be this, but if your code is OK (and the total days calculation looks fine), is the error in code elsewhere that is being published at the same time as your total days code?

it is just formula in business process. I have two dates field: begin date, end date. I must compare this and result should be in third field Integer only days but as an integer. This is what i must do. 

The error is likely because you're attempting to put the result of the formula in a boolean param or column and it's not a boolean, it's a double. If you're wanting to know if the number of days is greater than 5 days, for example, you could use the following, which would be a boolean:

RoundOff(([#data zakonczenia.First item of resulting collection.Data planowanego zamknięcie#]-[#data rozpoczecia.First item of resulting collection.Data rozpoczęcia#]).TotalDays) > 5

Ryan

I need to know the exact number of days because I will be using this information further, so the only way is to validate this?

 

Arkadiusz Polus,

if you need to know the number of days just make sure you putting the result of the formula in an integer param, not Boolean. 

Ryan

Show all comments