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” :=’’ 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.