How to solve total days count

Hai developers 

when I select the start date it will show negative numbers how to clear that issue kindly teach me, friends. but I need When I select a start date and end date in-between time shows only a zero number. how to clear the issue.

Hey Balaji,

If you don't want to calculate if there's no value, check if the date variable has value like: Start Data <> NullDate(). You can do an If condition in the expression where you have the Total Days.

For example: If(StartDate <> NullDate() and EndDate <> NullDate(), DiffDays(), ""), or something along these lines, depending on what you want.

Hope this helps you!

Hello Balaji,

Are you using the DiffDays() built-in function to calculate the days? You can check if the end date has value and, if not, don't calculate the total days value

Hey Balaji,

If you don't want to calculate if there's no value, check if the date variable has value like: Start Data <> NullDate(). You can do an If condition in the expression where you have the Total Days.

For example: If(StartDate <> NullDate() and EndDate <> NullDate(), DiffDays(), ""), or something along these lines, depending on what you want.

Hope this helps you!

Hi,

As Laura mentioned, you are probably using a DiffDays() between the end date and the start date to calculate the days to be taken. In your screenshot, since your end date is empty, in outsystems by default a Null Date is 1-1-1900, so you are basically doing a DiffDays(11-05-2022, 01-01-1900) which returns a negative number.

To fix this, just make an if condition checking if StartDate <> NullDate() and EndDate <> NullDate(), and only then you do the DiffDays!

Tell me if this helped! Cheers,
Paulo

Thanks for the help Paulo now has issues clear.

Hi @Balaji Rajaram 

Please go through this oml file:



Thanks

Mansur

textoml.oap

As mentioned above, you just need to check that start date and end date are not null date. Apart from this you should also check that end date is greater than start date other wise you will get -ve values in DiffDays().

regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.