Comparing fields of different data types

I want to compare two fields with different data types:

  1. Integer data type (year – 4 digits)
  2. Date type ( data_inicio_tarv/date of initiation of ARV) – I have used a substr function in a hidden value to extract the year and convert it to integer as follows: int(substr(#form/dados_do_paciente/data_de_inicio_de_tarv, 0, 4)).
    I want to compare the result of the hidden value, which is the extracted year (2) with the year entered in field 1, i.e, I compared if 1=2, but gives no result. What must be the problem?

Hi,

Overall you should be able to perform that comparison, so I think the issue here is likely with the data itself. You might want to look into the format-date() function as a way to extract the 4-digit date value, but otherwise it would be helpful to view the data outputs in the form directly to see what they are evaluating to.

-Clayton