I want to Calculate the age using DOB in Calculated filed

I want to Calculate the age using DOB in Calculated filed in the domain.

Here is my code example that I am using to complete this task but generated Syntax Error

    <string name="age" title="Age" formula="true">
  <![CDATA[
  if(birth_date != null)
            return "anything";
      else
            return "DOB not selected";
        ]]>
</string>

here is another Example I have try.

    <string name="age1" title="Age" formula="true">
  <![CDATA[
  if(employee0_.birth_date != null)
            return age(employee0_.birth_date);
      else
            return "Select DOB";
        ]]>
</string>

Both the code generated syntax error near employee0_.

for formula = true, we need to write sql in cdata

<![CDATA[

(  AGE(now(), employee0_.birth_date)  )

]]>

Try the above and share feedback

1 « J'aime »

It works thank you.

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.