Error same type at my code

Hi, i’m using this appformula to validate a datetime column and it working:

ISBLANK(
        FILTER(
              "agenda",
               AND(
                             ([_THISROW].[STATUS]<>"Os Fechada"),
                  OR(
                    AND(
                               ([_THISROW].[montador] = [montador]),
                              ([_THISROW].[agenda] >= [agenda]),
                              ([_THISROW].[agenda] <= [Previsão de Término])
                              ),
                    AND( 
                               ([_THISROW].[agenda] <= [agenda]),
                               ([_THISROW].[Previsão de Término]>=[agenda])
                              )
                        ) 
                    )
               )
)

But i need if the user is admin the column is free to put any date, i’m trying it but not working:

if(lookup(useremail(),usuarios,email,permissao)=“ADM”,[_this],

ISBLANK(
FILTER(
“agenda”,
AND(
([_THISROW].[STATUS]<>“Os Fechada”),
OR(
AND(
([_THISROW].[montador] = [montador]),
([_THISROW].[agenda] >= [agenda]),
([_THISROW].[agenda] <= [Previsão de Término])
),
AND(
([_THISROW].[agenda] <= [agenda]),
([_THISROW].[Previsão de Término]>=[agenda])
)
)
)
)
)
)

i’m getting this error:

1 Like

Try:

OR(
  (“ADM” = LOOKUP(USEREMAIL(), "usuarios", "email", "permissao")),
  ISBLANK(
    FILTER(
      “agenda”,
      AND(
        (“Os Fechada” <> [_THISROW].[STATUS]),
        OR(
          AND(
            ([montador] = [_THISROW].[montador]),
            ([_THISROW].[agenda] >= [agenda]),
            ([_THISROW].[agenda] <= [Previsão de Término])
          ),
          AND(
            ([_THISROW].[agenda] <= [agenda]),
            ([_THISROW].[Previsão de Término] >= [agenda])
          )
        )
      )
    )
  )
)
3 Likes

Steve’s suggestion is good.
But to directly respond to why your original expression didn’t work; it is exactly as the error message says, the if-result is not the same type and the else-result.
A valid_if expression must return a TRUE or FALSE (yes/no) value. Your else-result, ISBLANK() does that. But your if-result , [_THIS], is returning the value in the column (a datetime type).
If you had replaced [_THIS] with TRUE in your original expression, I believe it would have worked.
Hope that helps.

5 Likes