Date Validation

I have a question ..

1. When i search for a specific date from (06-01-2008 12:20:48) to (09-01-2008 13:13:11) its shows the result 


2. When i am not selecting a date and clicking search, it must shows a date between 2018 and the current date and it's working fine

For this function i added this line of code in the filter

Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate())
or
Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate()) -1


The problem is :

When i use either one of the above function the other function is not working ... How can i fix this issue ?!


Regards

Hind Ahmed 

Solution

Lets see if I understood correctly.


When the user writes a date, you want to search for such date.

When the user doesn't write a date you want to show the current and previous year.

And you say they both work but not simultaneously?


Your SQL must know when to use one or the other because dates in 2008 and in 2018/19 are not inclusive.

If you give a date, it searches for a date. If you don't give a date, it shows the last two years.


OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE=InputDate

or

(InputDate=NullDateIdentifier() 

and

(

Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate())
or
Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate()) -1

)


Is this want you meant to do?

Solution

Nuno Reis wrote:

Lets see if I understood correctly.


When the user writes a date, you want to search for such date.

When the user doesn't write a date you want to show the current and previous year.

And you say they both work but not simultaneously?


Your SQL must know when to use one or the other because dates in 2008 and in 2018/19 are not inclusive.

If you give a date, it searches for a date. If you don't give a date, it shows the last two years.


OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE=InputDate

or

(InputDate=NullDateIdentifier() 

and

(

Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate())
or
Year(OS_DC_EPAY_TRANSACTIONS_V.E_TRANS_DATE) = Year(CurrDate()) -1

)


Is this want you meant to do?

Hello Nuno Reis,

That's correct .. that what i was looking for ... Thanks for your help, i solved the issue 

Many thanks and regards

Hind Ahmed