ERROR (Invalid type)!

Hi, I have a quick question.

I am trying to calculate the age of a person. Once I have a age I have to set it to appropriate Type. For example if age is less then 18, then the type would be “Child”, if the age is less then 65, the type would be "Adult, and so on.

This is the code snippet that I have so far:

InputDate := TODAY;

Year := DATE2DMY(InputDate,3);

BirthDate := Customer.Birthdate;

BirthDay := DATE2DMY (BirthDate, 3);

IF (Customer.Birthdate = 0D) THEN

BEGIN

Job.“Primary Consumer Type” :=’’; <<<<============================

END;

PrimaryType := (Year - BirthDay);

CASE PrimaryType OF

1…17:

BEGIN

Job.“Primary Consumer Type” := ‘Child’;

END;

18…64:

BEGIN

Job.“Primary Consumer Type” :=‘Adult’;

END;

ELSE

BEGIN

Job.“Primary Consumer Type” := ‘Senior’;

END;

END;

The error Message I get on this line (Job.“Primary Consumer Type” :=’’:wink: is: Type conversion is not possible because 1 of the operators contains an invalid type. Option := Text

Primary Consumer Type is an Option field with the following options child, senior, adult, etc

I know the reason of the error, I just dont know how to fix it.

Job.“Primary Consumer Type” := Job.“Primary Consumer Type”::Child;

Job.“Primary Consumer Type” := Job.“Primary Consumer Type”::Adult;

Job.“Primary Consumer Type” := Job.“Primary Consumer Type”::Senior;

[:(]

But in reality this is NAV programming 101 and if you are going to be programming in Navision you have to at least open the developers guide and learn something.