204
Views
4
Solved
###### 7.5 Excercise &gt;  Cannot apply '&gt;' operator to 'Date' together with 'Integer'
Question
Service Studio Version
11.14.7 (Build 58100)

Hi, I'm still studying traditional development and I need to validate this

1. Add validation to the Save Action in the PersonDetail Screen that verifies that the date of birth needs to be before the current date(please see the screenshot below).

I've just started this course, so if you give me a reference I'm very grateful.
Thanks

2022-02-24 01_34_08-.png
Champion
Solution

I think you have to do the same thing to the date birth using the Year method.

`Year(CurrDate())>Year(CurrDate())`

Kind Regards,

Márcio

Solution

Hello Angelo,

At beginner level it may be difficult to understand so here is a simple way to check if the birth date is less than current date or not

PersonForm.Record.Person.DateofBirth < Currdate().

Regards,

Pavan R

Solution

you are comparing a dateTime or date is greater than a year value.

You have to compare 2 values of the same type.

If you gonna get the year from the current Date you have to get the year from the PersonForm.Record.Person.DateofBirth.

Or you put only the year from the 2 dates like this:

Year(CurrDate())>Year(CurrDate())

Or with date type like this

PersonForm.Record.Person.DateofBirth < Currdate().

Remember you can only compare 2 values from the same type

Champion
Solution

I think you have to do the same thing to the date birth using the Year method.

`Year(CurrDate())>Year(CurrDate())`

Kind Regards,

Márcio

Solution

Hello Angelo,

At beginner level it may be difficult to understand so here is a simple way to check if the birth date is less than current date or not

PersonForm.Record.Person.DateofBirth < Currdate().

Regards,

Pavan R

Solution

you are comparing a dateTime or date is greater than a year value.

You have to compare 2 values of the same type.

If you gonna get the year from the current Date you have to get the year from the PersonForm.Record.Person.DateofBirth.

Or you put only the year from the 2 dates like this:

Year(CurrDate())>Year(CurrDate())

Or with date type like this

PersonForm.Record.Person.DateofBirth < Currdate().

Remember you can only compare 2 values from the same type